It's not "advanced programming" -- you just have to think carefully about exactly what you want the program to do. Here's my version. Make sure you can trace it in your head, step by step. If there's something here that you don't understand, ask.
Code:
const int MAX = 70; // reduced to 70 instead of 100
int word_length, line_length = 0;
if( input >> buff ) {
line_length += strlen( buff );
cout << buff;
while( input >> buff ) {
word_length = strlen( buff );
line_length += word_length + 1;
if( line_length > MAX ) {
cout << "\n" << buff;
line_length = word_length;
} else {
cout << ' ' << buff;
}
}
cout << "\n";
}
This will work if you don't try to give it a word longer than 69 chars. Anything bigger than that is likely to either print garbage or crash it by overflowing the buffer.