Hi! i'm a bit new in c++ so i'v got some question wish you to answer me...!
first of all i want my program to show the specific group of line of my file so i use this code for it:
using namespace std;
int main()
{
ifstream myfile;
myfile.open("test.txt");
cout<<"which line to start showing?";
string showline;
cin>>showline;
string line;
while(getline(myfile,line))
{
if(line==showline)
{
do
{
cout<<line<<endl;
}while(line!="javad");
}
}
myfile.close();
}
what is the problem of this code? can anyone give the correct one of this or another one for my question?
2.after that i want my program to delete specific lines of my file... i don't have any idea what to do... can anyone give the code?
thanks so much!
the inner loop doesn't make sense, it's already handled by the outer loop. you may omit line 19 and 20. they don't have any use when the inner loop is removed