0
sharing a code on solo learn
i have done a code so i tested it on "code-block" and it works when you use my code you need to input some numbers and i made a "cout" that tells you what number you should enter but the "cout" appears after they ask you about the number and also they ask you about a variable just one time but i was coding more than one "cin" and between them there are many work so why ??? and don't forget that i have launched it on "code-block" and it was perfect thx previously
6 Answers
+ 1
The code playground is somewhat restricted when it comes to input because your code is sent to some online servers along with the input, compiled, and then the output is sent back to your machine, where it is displayed. That means all input must be provided at the start of the program (see example from Hadia Khalid), contrary to a real compiler. If you want to make truly interactive codes here on SoloLearn, you would have to resort to web codes.
0
i have actually separated the inputs ..... i did it like
int x,y ;
cout << "enter 1" <<endl;
cin >> x ;
cout <<"enter 2" <<endl ;
cin >> y ;
not the same purpose of my code Definitely đ
0
I got it.... but one more thing
now i'm OK with input but how I can tell the users what should they input.... like "cout" before "cin"..... or I should resort to Web codes as you said
0
A common thing is a comment at the very top of your code that describes what input is expected, so that others immediately see it when opening the code. And no need to switch to web, there's a lot of cool stuff you can do even in this environment! :)