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
33 Answers
New AnswerRemove 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;
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; }
#include <iostream> using namespace std; int main() { //your code goes here int a; cin>>a; cout<<50-a%50; return 0; }
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
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;}
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.
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?
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?
Michael Rose Sololearn puts inputs automatically. This is a practice test of Sololearn.
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 !
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