how can i end a while loop ??

Started by
11 comments, last by games_mylife10 18 years, 11 months ago
Quote:Original post by Anonymous Poster
combining his name, his location and

using std::cout;
using std::cin;
etc.

and

char text[1000];

I'd say he's kidding...

You do know Bahrain is a real place, right?

In my tests, ^z works just fine. It has to be at the begining of the line, though, or it gets confused.
Enter several lines of text:Enter end-of-file to END input.?Line One?Line Two?^Z


"Line One" and "Line Two" get written to the file, and then the program ends.

CM
Advertisement
Quote:
char text[1000];

while (cin.getline (text,1000)){
outlinefile <<text<<endl;


Can be rewritten in C++

std::string text;while( std::getline( cin, text ) ){   outlinefile << text << std::endl;   ...}


[wink]
Hello !!

Thank you verrrrrrrry much~~~!!!!
it worked for me , i don't know what happened yesterday!! today it worked with ctrl+z ..

sorry about my stupid question but i'm a beginner and i'm not good in programming.. i'm trying my best to get better i hope!

and i'm really from Bahrain.. even when i was regestering in this forums .. i choose Bahrain and then a list of bahrain's cities appeared too !! :D


thank you again for the help!

This topic is closed to new replies.

Advertisement