How does that works?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How does that works??

Please help I delete the "num ++" and it says there is "no input" isn't it supposed that: inputs with "cout"? And why can I write numbers greater than 6, if it says it stops working until the number is greater than 5 https://code.sololearn.com/cygcmIT65oOO/?ref=app

28th Dec 2019, 4:20 AM
Hyst1k
Hyst1k - avatar
14 Answers
+ 2
What do you mean
28th Dec 2019, 4:27 AM
ycsvenom
ycsvenom - avatar
+ 2
Firstly it's get the input from user 5 times as while loop the every round it will add the input to total and then output the total
28th Dec 2019, 4:29 AM
ycsvenom
ycsvenom - avatar
+ 2
If there anything else you need please tell me
28th Dec 2019, 4:29 AM
ycsvenom
ycsvenom - avatar
+ 2
You can enter any number within the integer type range because only the "num" value cannot exceed 5 but the "number" you are entering can.
28th Dec 2019, 4:31 AM
Avinesh
Avinesh - avatar
+ 2
num++ is incremented at every iteration till it is equal to 5. Once it becomes greater than 5 then the while loop is terminated.
28th Dec 2019, 4:34 AM
Avinesh
Avinesh - avatar
+ 2
And the compiler read like English writing from left to right if it's ++num it will increase by one first then will give value of num and if it's num++ it's will give value of num then increase it by one For example X=6 Y=++X //Y=7 and X =7 Y=X++ //Y=7 and X=8
28th Dec 2019, 4:37 AM
ycsvenom
ycsvenom - avatar
+ 2
Num is for looping count Number is for input
28th Dec 2019, 4:40 AM
ycsvenom
ycsvenom - avatar
+ 2
Everything alright now
28th Dec 2019, 4:41 AM
ycsvenom
ycsvenom - avatar
+ 1
I edited it, did you read it yet?
28th Dec 2019, 4:28 AM
Hyst1k
Hyst1k - avatar
+ 1
But then, what does the "num ++" have to do??
28th Dec 2019, 4:32 AM
Hyst1k
Hyst1k - avatar
+ 1
what is the "num ++" for
28th Dec 2019, 4:33 AM
Hyst1k
Hyst1k - avatar
+ 1
It's increase the value of num by 1
28th Dec 2019, 4:33 AM
ycsvenom
ycsvenom - avatar
+ 1
So "num ++" and "number" complement each other?
28th Dec 2019, 4:39 AM
Hyst1k
Hyst1k - avatar
+ 1
Yeah i think so, thx all of you
28th Dec 2019, 4:42 AM
Hyst1k
Hyst1k - avatar