So messy, a loop should be broken by satisfying the while condition.Code: [Select]int main (){int total = 0;int input = 0;bool quit = false;while ( quit == false ){cin >> input;total = total + input;if ( input == 0 )quit = true;cout << total << endl;}return 0;}
int main (){int total = 0;int input = 0;bool quit = false;while ( quit == false ){cin >> input;total = total + input;if ( input == 0 )quit = true;cout << total << endl;}return 0;}
Hoping to move on to Assembly
#include <iostream>using namespace std;int main (){int total = 0;int input;bool quit = false;while(quit == false){ cin >> input; if(input == 0){ quit = true; break;} total = total + input; cout << total << endl;}return 0;}