...

View Full Version : Never ending loops stops at EOF



flint0131
08-13-2009, 09:17 PM
I need to make a program that stops when the user press ctrl+Z..
if the user doesn't press ctrl+Z, it won't stop the loop prompting
"Enter a Number : ".. but when the user press ctrl+Z, then it will display
"The sum of all the inputed numbers is : "..

Here's my code :


#include <stdio.h>
#include <conio.h>
#include <iostream.h>

int main(void) {
clrscr();

do {
for ( int i = 0; ; i++ ) {
int num[i]. sol[i];
}
cout<<"Enter a Number : ";
cin >> num[i];
sol[i] += num[i];
if ( cin.eof() ) {
cout<<"The Sum is : " << sol[i];
} while ( !cin.eof() );
getch();

}

but it wont work.. D:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum