It appears Sololearn doesn't support multiple input for c++ files??? | Sololearn: Learn to code for FREE!

+2

It appears Sololearn doesn't support multiple input for c++ files???

My code requires input at multiple points in the program. When I run it on Sololearn, it says "It looks like your code requires input" and then it runs using what I input THROUGHOUT the code. How do I fix this? https://code.sololearn.com/cc0h9nc6103S/?ref=app

12/7/2021 5:20:59 PM

Kami

15 Answers

New Answer

+7

Unfortunately that's how sololearn ( and a lot of other online IDEs ) work. As your program compiles and runs on a different machine ( SL servers ) only for a limited period of time ( to reduce the load on server ), halting the program execution to request client for another input would be too expensive. Hence sololearn takes all of the input once from you before even sending the program to their servers for execution. If you want to send more than one input then just seperate them with whitespaces ( space, tab or newline character )

+4

Nice code! You must change it in order to work on SL. There is a C solution on get your day of the week when you were born. This improves it by adding the horoscope 😉

+4

cuz code playground is executed in the server. thus why it asks for input first. well, there's no solution for this other than inputting the values yourself, separating different inputs in multiple lines. and am I the only one whose eyes are bleeding after seeing his code?

+3

Just enter your first input then press enter then second input followed by enter at last submit it will work

+2

Romeo Cojocaru Thanks! I didn't know there was a Day of the Week program until today 😅

+2

solo learn doesn't support this with any programing, if you want to give multiple input, just give like this 10 10 2002 min there are 3 inputs 10, 10 and 2002

+1

Kami, and so you learned that in SoloLearn it is necessary to enter all the data at once. I recommend that you always write a comment with an instruction and an example of data entry at the beginning of the code: /* Hello! Do YOU want to know what your birthday says about you? Well, I 'm here to help! Enter your birth date to get started (day, then space, month, then space... then press enter). Okay, now pick a number below to select what you want to see about yourself: 1 - Print my birthday. 2 - What's my zodiac sign? 3 - What does my zodiac sign say about me? 4 - All of the above. Press 0 to start over and 1 to exit. Example input: 7 12 2021 4 1 */ P. S: "Lines 51 - 57, this part of the code is not used, comment it out or remove it." /* void birthday::setBirthday(int d, int m, int y) { int day, month, year; day = d; month = m; year = y; }*/

+1

Thanks a lot guys. I rewrote the code so I only have to use one input, that is, the birthday input. This is the new one. https://code.sololearn.com/c36aBWc7SJXW/?ref=app

+1

Use cxxdroid as it works offline too

0

Vasiliy Thanks for the suggestion. And I have removed the setBirthday function as it isn't useful.

0

Rellot's screwdriver I wonder what you mean by your last comment though 😂

0

Thanks, Arsenic , for your suggestion 🙂

0

Nice code! You must change it in order to work on SL.There is a C solution on get your day of the week when you were born.

0

Ritik Raushan So, how your comment is differently by mine?! 🤣😅😂

0