0

i have some project that ask me to write a program that will ask the user to input n positive number.

the program will terminate if one of those number is not positive.since i'm new,i don't have any idea>.<

23rd Jan 2017, 8:40 AM
nsazw
nsazw - avatar
5 odpowiedzi
+ 2
pseudo: int foo; do{ foo = input(); if(foo < 0) break; }while(true);
23rd Jan 2017, 8:46 AM
bem
bem - avatar
+ 1
int n; int num; int termination = 0; cout << "how many numbers do you want to enter?"; cin >> n; for(n; n > 0; n--) { cout << "enter nunber"; cin >> num; if(num < 0) { termination = 1; n = 0; } }
23rd Jan 2017, 8:53 AM
shay lempert
shay lempert - avatar
0
what does foo stand for?
23rd Jan 2017, 11:21 AM
nsazw
nsazw - avatar
0
my coding was failure
23rd Jan 2017, 11:32 AM
nsazw
nsazw - avatar
23rd Jan 2017, 12:29 PM
bem
bem - avatar