cin always executing without being called | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

cin always executing without being called

please help, for some reason, even without running the function containing cin, it always runs and asks for input I've tried the exact same code on other compilers and it doesn't happen, is this a bug in sololearn? or am I doing something wrong?

14th Sep 2020, 3:15 AM
Greg
Greg - avatar
4 Answers
+ 5
You have to provide sololearn the input beforehand means at the compile time, during when sololearn does not know wether that "cin" would be executed at runtime or not, so just to be prepared it asks you for input.
14th Sep 2020, 3:19 AM
Arsenic
Arsenic - avatar
+ 2
You can enter the value before and if the function is not called it will not be used so it is okey
14th Sep 2020, 3:27 AM
Ruba Kh
Ruba Kh - avatar
+ 1
Arsenic how do I tell sololearn I want the cin to be requested after the cout (during runtime)
14th Sep 2020, 3:24 AM
Greg
Greg - avatar
0
coffeeunderrun okay then, is there another way to take inputs from the user? in my game there will be constant inputs required from the user, is it not possible at all in sololearn?
14th Sep 2020, 3:27 AM
Greg
Greg - avatar