Login Register


C++ program filter_list
Author
Message
RE: C++ program #14
I know it's a bit late reply, but incase someone else stumbles upon this thread I'd like them to know there're other ways to do it as well, one way I prefer is like this:

Code:
int main(){ // We want to initiate the values for safety precautions int input = -1, sum = 0; // while we're recieving inputs and the input is not equal to 0 while (cin >> input && input != 0){ // same as sum = sum+input sum += input; } cout << sum; return 0; }

Reply





Messages In This Thread
C++ program - by BORW3 - 05-10-2014, 12:43 PM



Users browsing this thread: 1 Guest(s)