+ 5

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

29th Nov 2020, 1:33 PM
lifeismyschool
36 odpowiedzi
+ 1
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;
29th Nov 2020, 1:50 PM
Brian
Brian - avatar
+ 14
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; }
1st Dec 2020, 11:05 AM
Shamil Bedru
Shamil Bedru - avatar
+ 6
#include <iostream> using namespace std; int main() { //your code goes here int a; cin>>a; cout<<50-a%50; return 0; }
30th Nov 2020, 7:35 PM
Sanjar Egamberdiyev
Sanjar Egamberdiyev - avatar
+ 3
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
16th Dec 2020, 12:40 PM
Lam Wei Li
Lam Wei Li - avatar
+ 3
Use this code for transportation problem #include<iostream> using namespace std; int main() { int pass; int seats; cin>>pass; seats=pass%50; cout<<50-seats; return 0;}
4th Feb 2021, 9:35 AM
isbah
isbah - avatar
+ 2
It is ok😊
29th Nov 2020, 7:28 PM
lifeismyschool
+ 2
Hello Amit. You can ask any question to people in Sololearn.
2nd Dec 2020, 9:15 AM
lifeismyschool
+ 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.
29th Nov 2020, 1:55 PM
lifeismyschool
+ 1
Brain I tested it myself and I got what you mean.
29th Nov 2020, 2:02 PM
lifeismyschool
+ 1
But the bug is just that?
29th Nov 2020, 2:03 PM
lifeismyschool
+ 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?
29th Nov 2020, 2:22 PM
lifeismyschool
+ 1
Thanks a lot for answer of hidden test cases.
29th Nov 2020, 3:04 PM
lifeismyschool
+ 1
Michael Rose Sololearn puts inputs automatically. This is a practice test of Sololearn.
29th Nov 2020, 7:20 PM
lifeismyschool
+ 1
oh sorry just started yesterday
29th Nov 2020, 7:21 PM
Michael Rose
+ 1
cout<<(50-a)%50; is okay.
30th Nov 2020, 8:00 PM
lifeismyschool
+ 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 !
1st Dec 2020, 12:02 PM
Bibek Pant
Bibek Pant - avatar
+ 1
Thank you everyone. I did it.😉
2nd Dec 2020, 9:17 AM
lifeismyschool
+ 1
Khalique ur rehman welcome to Sololearn! This task comes from the C++ tutorial, Lesson 11 Transportation. It is a Code Coach challenge, which tests your program with various console inputs and compares the output with expected results. The problem statement only requires calculating the number of empty seats in the last bus when given the total number of passengers. While it is admirable to create a class that models the whole excursion, the actual task has none of those requirements. Guard against overdesign.
16th Oct 2022, 9:52 AM
Brian
Brian - avatar
0
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?
29th Nov 2020, 2:32 PM
lifeismyschool
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
29th Nov 2020, 7:03 PM
Michael Rose