+ 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
33 Respostas
+ 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;
+ 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;
}
+ 6
#include <iostream>
using namespace std;
int main() {
//your code goes here
int a;
cin>>a;
cout<<50-a%50;
return 0;
}
+ 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
+ 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;}
+ 2
It is okš
+ 2
Hello Amit. You can ask any question to people in Sololearn.
+ 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 !
+ 1
Thank you everyone. I did it.š
+ 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.
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?
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