0
int num = 1; int number; while (num <= 5) { cin >> number; num++; }
can any one tell me this code in simpler way. I didn't understand anything.
2 Answers
+ 3
ŠŠ¼ŠøŃŃŠ¾ ŠŠ²Š°Š½Š¾Š² 5 times.
+ 1
int number;
for(num=1;num<=5;++num)
{
cin>>number;
}
The code 4 times asks you to input an integer and saves it to number variable. Because it is saved into the same variable, after the cycle finishes, the last value you had entered is saved.