How can i get out from this loop ???

Write here if you have problems with your C++ source code

Moderator: Board moderators

Post Reply
Peter Cahyadi
New poster
Posts: 2
Joined: Mon Mar 01, 2004 4:51 am
Location: Indonesia

How can i get out from this loop ???

Post by Peter Cahyadi »

hi i'm new to this message board . so if anybody would kind enough to answer my question i'd appreciate it very much

the question is how can i get out from this loop ?? or what is the condition so the loop will end ???

int a;

while( cin >> a )
{
cout << a;
}

thanx !! :D
UFP2161
A great helper
Posts: 277
Joined: Mon Jul 21, 2003 7:49 pm
Contact:

Post by UFP2161 »

When EOF [end of file] (if you're using standard input, i.e. not passing in a file, a Ctrl+D will terminate input) is reached.
Peter Cahyadi
New poster
Posts: 2
Joined: Mon Mar 01, 2004 4:51 am
Location: Indonesia

Post by Peter Cahyadi »

thank you very much
i've tried your suggestion ( by pressing ctrl+d ) and it works!
thanx again ! :lol:
Post Reply

Return to “C++”