+ 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

7th Dec 2021, 5:20 PM
Kami
15 Antworten
+ 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 )
7th Dec 2021, 5:26 PM
Arsenic
Arsenic - avatar
+ 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 😉
7th Dec 2021, 5:29 PM
Romeo Cojocaru
Romeo Cojocaru - avatar
+ 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?
7th Dec 2021, 5:30 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
+ 3
Just enter your first input then press enter then second input followed by enter at last submit it will work
9th Dec 2021, 8:07 AM
Abhishek Pandey
Abhishek Pandey - avatar
+ 2
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; }*/
7th Dec 2021, 6:25 PM
Solo
Solo - avatar
+ 2
Romeo Cojocaru Thanks! I didn't know there was a Day of the Week program until today 😅
7th Dec 2021, 8:02 PM
Kami
+ 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
8th Dec 2021, 6:13 PM
RTB
RTB - avatar
+ 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
7th Dec 2021, 8:00 PM
Kami
0
Vasiliy Thanks for the suggestion. And I have removed the setBirthday function as it isn't useful.
7th Dec 2021, 8:01 PM
Kami
0
Rellot's screwdriver I wonder what you mean by your last comment though 😂
7th Dec 2021, 8:03 PM
Kami
0
Thanks, Arsenic , for your suggestion 🙂
7th Dec 2021, 8:04 PM
Kami
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.
9th Dec 2021, 2:47 PM
Ritik Raushan
0
Ritik Raushan So, how your comment is differently by mine?! 🤣😅😂
9th Dec 2021, 3:15 PM
Romeo Cojocaru
Romeo Cojocaru - avatar
0
Really?
9th Dec 2021, 5:31 PM
Sumaila Pique
Sumaila Pique - avatar