Page 1 of 1

How can i get out from this loop ???

Posted: Mon Mar 01, 2004 5:13 am
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

Posted: Mon Mar 01, 2004 5:17 am
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.

Posted: Mon Mar 01, 2004 6:43 pm
by Peter Cahyadi
thank you very much
i've tried your suggestion ( by pressing ctrl+d ) and it works!
thanx again ! :lol: