+ 8

C++ Course - Do I Need PRO Account to Complete Problems?

Hi, I am doing Module 1 : Transportation. My code compiles fine and passes test cases in VS Code. However, when running the program, I am not able to take in any user input. Even If I hard-code the values, it does not work either. What is going on here? My code: #include <iostream> #include <string> using namespace std; int main() { cout << "enter bus passengers at station: " << endl; int stationPassengers = 0; cin >> stationPassengers; cout << stationPassengers; int lastBus = 50-(stationPassengers % 50); cout << "Number of empty seats: " << lastBus << "\n"; return 0; } I know this does not work with the multiples of 50 cases. The point is that when I execute the program, I cannot input anything to be assigned and then tested. Thanks! (I am using Chrome!)

29th Jan 2021, 5:13 PM
Jonathan Pollard
26 Respuestas
+ 6
Jonathan Pollard Please, share complete description of your problem including your attempt. From your attempts I am assuming you are asking about code coach "Transportation" from CPP. >>>>>> Your code: #include <iostream> #include <string> using namespace std; int main() { cout << "enter bus passengers at station: " << endl; int stationPassengers = 0; cin >> stationPassengers; cout << stationPassengers; int lastBus = 50-(stationPassengers % 50); cout << "Number of empty seats: " << lastBus << "\n"; return 0; } <!‐-----------------------------------------------> In your code you have used another header <string> & included all attached string for input & getting output for passengers that are completely not required. I assume you would have ran your code multi times. Did you thoroughly see what was the output given? -> Step to keep in mind before solving problems "read instructions given carefully, try to understand it & then solve problems -> First r
29th Jan 2021, 8:31 PM
Shivani 📚✍
Shivani 📚✍ - avatar
+ 6
Jonathan Pollard , you don't need Pro account to complete unless you are looking forward to solve more code coaches that are available for PRO users.
29th Jan 2021, 8:33 PM
Shivani 📚✍
Shivani 📚✍ - avatar
+ 5
No man,you can solve the problem without join in PRO. But if you want! you must join in PRO you will learn more in PRO ...
30th Jan 2021, 7:22 PM
IT'S SS
IT'S SS - avatar
+ 4
You don't need any pro account to complete the course. you can also learn it in dekstop as solo learn is having it's own website . www.sololearn.com
30th Jan 2021, 11:11 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 3
Jonathan Pollard My apologies. I didn't see that problem is in your code. The problem requires you to output *just* the answer. But in your code you also outputting first the value of `stationPassengers` and then the text "Number of empty seats: ". You don't have to do that. You have to output *just* the answer (in your case, the value of the variabke `lastBus`) Also, don't hardcode the values SoloLearn will pass input to the program
29th Jan 2021, 6:11 PM
XXX
XXX - avatar
+ 2
I wish to use the desktop so I can check with VS Studio.
29th Jan 2021, 5:46 PM
Jonathan Pollard
+ 2
Please read my question - I am using the desktop. It is not taking input! Even if I hard code values, it still does not accept them for test casing. The code compiles and works in VS Code.
29th Jan 2021, 6:03 PM
Jonathan Pollard
+ 2
Jonathan Pollard check out the code mentioned by Ali to know how to enter the input. Basically, all inputs have to be entered at once. This is because SoloLearn sends your code to a server to run, and that is where the inputs are passed in to the program. From what I understood, you're on a PC. I suggest you stick to running your codes on your PC. Apart from the input problem, SoloLearn has even more limitations because of the same reason as above that the codes are not actually run on your computer. Use SoloLearn only for the courses and the Q&A section.
29th Jan 2021, 6:04 PM
XXX
XXX - avatar
+ 2
Jonathan Pollard I'm sorry, but I don't understand. What's the bug? Also, most platforms require the same thing. The output needs to be of the exact format. And I somewhat agree with you. The web version of SoloLearn can be pretty bad sometimes. I would suggest you install the SoloLearn app on your phone. Although, it wouldn't make any difference in the way inputs are taken, but I can certainly say that it is less of a headache. I (and many other people) mostly come here because of the *very* friendly community, because to be honest, the courses are not very different from the others on the web. But the community and features are a total plus on SoloLearn. See for yourself, 3 people came forward to help you in your problem.
29th Jan 2021, 6:36 PM
XXX
XXX - avatar
+ 2
XXX Consider the case of 50 people at the station. The last bus will actually have 0 seats filled - not 50. The program does not test for the case of n*50.
29th Jan 2021, 6:57 PM
Jonathan Pollard
+ 2
Jonathan Pollard hmmm... I see what you mean. And yeah, there are many such practise problems on SoloLearn where testing is not done properly, that is, codes work when they shouldn't. The devs need to work on that I guess.
29th Jan 2021, 7:06 PM
XXX
XXX - avatar
+ 2
You only need the Pro account for extra code coach problems and a few non programming related features.
30th Jan 2021, 9:53 AM
Sonic
Sonic - avatar
+ 2
Why did u included string?
31st Jan 2021, 1:46 PM
Jakub Czucha
Jakub Czucha - avatar
+ 1
I would suggest to use the app
29th Jan 2021, 5:18 PM
Ali
Ali - avatar
+ 1
I haven't got time to go through that waffle, what is the necessary way for the sololearn compiler to take input?
29th Jan 2021, 5:54 PM
Jonathan Pollard
+ 1
XXX- The problem is that I cannot complete the unit and therefore I cannot work to certification! I cannot also unlock further test cases...
29th Jan 2021, 6:05 PM
Jonathan Pollard
+ 1
XXX Can you give me an example, I am not sure how sololearn knows what variables to work with?
29th Jan 2021, 6:24 PM
Jonathan Pollard
+ 1
XXX I have got it working but I think this is a really sloppy way of doing things. And although it passed all the test classes, there is an obvious bug - multiples of 50. This platform is junk!
29th Jan 2021, 6:27 PM
Jonathan Pollard
+ 1
Yes Jonathan Pollard you can also learn it in desktop as solo learn is having it's own website www.sololearn.com
31st Jan 2021, 10:42 AM
Dharwin R V J
Dharwin R V J - avatar