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 Antworten
+ 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.