Hi, could you please help with the following:
I have an input file like:
one
two
three
four
five
six
I want to print the lines starting from 'three' to the empty line.
Something like that:
if ( line == "three" )
{
while ( !line.empty() )
{
cout << line << endl;
line++;
}
}
Could you please help, how to do that.
---------- Post updated at 05:48 PM ---------- Previous update was at 04:47 PM ----------
I fix it:
if ( line == "three" )
{
cout << line << endl;
while ( !line.empty() && getline(myfile, line))
{
cout << line << endl;
}
}
Output:
three
four
five