November 2019
— I guess you want to run the loop as long the input is valid :) so in this case you should do
while(scanf("%i", &somenum) == 1)
Message permanent page
The while loop runs as long as one input value is succesfully parsed and assigned - that should be it
— Thank you
— Haha ^^ your welcome
— Is it possible to use an if statement instead of a while loop?
— If scanf equals to 1 else …
— Sure for example:
if(scanf("%i", &somenum)) { //Okay } else { //Dammit something went wrong}
— Nice
— reinterpret_cast how long you have been coding for ?
— I started when I was 11 and I´m 18 now so 7 years ^^ and every day at least 3 hours - I´m crazy 😂
— And you?
— Not very long but i been coding mostly everyday