0

loop and x++ question, please help me to explain what's going on

#include<iostream> using namespace std; int main() {int x = 1; int a; int total = 0; while (x <= 5) { cin >> a; total += a; x++; cout<<"ok"<<total<<endl;} } a=0 total ok0 ok0 ok0 ok0 ok0 --------- a=1 ok1 ok2 ok3 ok4 ok5 --------- a=2 ok1 ok2 ok3 ok4 ok5 ---

30th Jan 2017, 2:23 AM
Leon Hu
Leon Hu - avatar
1 Odpowiedź
+ 3
? says you finish course? how you no know yourself? or it this a test? are you tricking me :)
30th Jan 2017, 2:50 AM
jay
jay - avatar