Is it possible to get user input (cin) when my program is running in playground ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is it possible to get user input (cin) when my program is running in playground ?

24th Aug 2016, 9:27 AM
Samy
Samy - avatar
6 Answers
+ 3
Unfortunately not. It's one of my greatest hates against the code playground. The input system is terrible.
24th Aug 2016, 10:03 AM
Cohen Creber
Cohen Creber - avatar
+ 2
I have same question. If I run same code on a computer, I can input many times as the code requests, but on SoloLearn's compiler, I have to input all the numbers (or words, etc.) in a row before compiling. I think we should interact with the code, not just ask it to work.
24th Aug 2016, 10:26 AM
TzuHan Chen
TzuHan Chen - avatar
+ 1
Oh damn, was coding a more or less... Anyway thanks! I'll release it and people may execute it in Visual 😂
24th Aug 2016, 10:04 AM
Samy
Samy - avatar
+ 1
@Anita What do you mean ? Using an other way to ask for user input or update SoloLearn compiler ?
24th Aug 2016, 10:34 AM
Samy
Samy - avatar
+ 1
Ok! Yeah it's annoying but maybe it will be changed in the future !
24th Aug 2016, 2:18 PM
Samy
Samy - avatar
0
@Samy Let me explain my answer. Here is a code: int main () { int name, age; cout << "What's your name?\n"; cin >> name; cout << "It's a good name.\n"; cout << "How old are you?\n"; cin >> age; cout << "Oh, you're " << age << " years old.\n; return 0; } If I run this code on a computer, I'll see: What's your name? (INPUT)Anita It's a good name. How old are you? (INPUT)1000 Oh, you're 1000 years old. But, if I run this code on SoloLearn's code playground, I'll see: (INPUT)Anita 1000 What's your name? It's a good name. How old are you? Oh, you're 1000 years old. On a COMPUTER, it seems that my code can INTERACT WITH ME; but on SOLOLEARN'S CODE PLAYGROUND, my code is TALKING WITH ITSELF, and I think this phenomenon is weird. To reply @Samy, there's no other way to ask for user input, so I hope SoloLearn can update its compiler. Hope you won't think my explanation is too long.
24th Aug 2016, 12:54 PM
TzuHan Chen
TzuHan Chen - avatar