Transportation Test Case #1 / Case#2 in C++ Course | Sololearn: Learn to code for FREE!

+3

Transportation Test Case #1 / Case#2 in C++ Course

Hi dear friends. I wrote a C++ code. But Sololearn says my code is not quite correct. I sent a feedback for it to Sololearn. But they didn't reply me. So, I ask your help.This is a test of Sololearn. Sololearn gives the inputs and gets the outputs in the C++ course. Even if the outputs are correct, Sololearn says that there was some bugs. And Sololearn advice me to practice with code coach. But the code coach is paid. I don't know what the omission is. Where do you think there are errors or omissions? https://code.sololearn.com/c6ojwKkY3cSJ/?ref=app

11/29/2020 1:33:24 PM

lifeismyschool

32 Answers

New Answer

+3

Remove the text from the output so that it prints only the number, just like their example and what they show in "Expected output". Change cout<<"Empty Seats: "<<emptyseats; To cout<<emptyseats;

+10

Like the others said omit the printed text but u can do it in a very simple way like this: #include <iostream> using namespace std; int main() { //your code goes here int a,b; cin>>a; /*a is for number of passengers*/ b= 50-a%50; cout<< b; return 0; }

+6

#include <iostream> using namespace std; int main() { //your code goes here int a; cin>>a; cout<<50-a%50; return 0; }

+2

Thanks a lot everyone. I passed the test cases. Sololearn have 5 test cases. But it just let me to see the first two ones it says although it said I passed the other three test cases. Do you know why?

+2

It is ok😊

+2

Hello Amit. You can ask any question to people in Sololearn.

+2

Thank you everyone. I did it.😉

+2

A simple three lines of code implementation. First, you use the modulus function to find the remainder, which are the passengers on the last bus. Then, to find the empty seats, you use bus capacity minus away the last passengers. https://code.sololearn.com/cAsIKRZH3quK/?ref=app

+1

This is a test of Sololearn. Sololearn gives the inputs and gets the outputs in the C++ course. Even if the outputs are correct, Sololearn says that there is some bugs. And it advice me to practice with code coach. But the code coach is paid. I don't know what the omission is.

+1

Brain I tested it myself and I got what you mean.

+1

But the bug is just that?

+1

Thanks a lot for your advices. I will try to practice with code coach problems in community section. But I guess, I didn't add any something extra in this code. What is extra in the code?

+1

Thanks a lot for answer of hidden test cases.

+1

Michael Rose Sololearn puts inputs automatically. This is a practice test of Sololearn.

+1

oh sorry just started yesterday

+1

cout<<(50-a)%50; is okay.

+1

Yes, your code is correct however, you should follow their output sample. Here output sample is expecting only number, so just print number. No need of text !

0

i just started with solo learn but from what i see you have no user input to say the number of passengers in your station to start should be a simple fix just start the program with a user input line and add a variable for the number of passengers in uour station

0

Michael Rose the user input comes from line 16, cin (console input).

0

#include <iostream> using namespace std; int main() { //your code goes here int a; cin>>a; cout<<50-(a%50); return 0; }