0

I tried this code : int num = 1; int number; while (num <= 5) { cin >> number; num++; }. But it showed no output

20th Jul 2018, 3:44 PM
Abhinav Anand
Abhinav Anand - avatar
7 Réponses
+ 3
You didnt print anything
20th Jul 2018, 3:46 PM
Bebida Roja
Bebida Roja - avatar
+ 2
You have to print something if you want an output.
20th Jul 2018, 3:59 PM
Satyam
+ 1
but, if you execute that piece of code, 'number' will only contain the value of the last input, as you are rewriting its value each time you input something.
20th Jul 2018, 4:02 PM
Bebida Roja
Bebida Roja - avatar
+ 1
what do you want the number input for?
21st Jul 2018, 6:13 AM
Satyam
0
can you explain with example
21st Jul 2018, 6:11 AM
Abhinav Anand
Abhinav Anand - avatar
0
I have understood to execute an output I need to write a cout<<num
21st Jul 2018, 6:17 AM
Abhinav Anand
Abhinav Anand - avatar