How to answers the different test cases in (transportation)test,iam confused. Once I complete the #1 test, the #2 one goes wrong | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to answers the different test cases in (transportation)test,iam confused. Once I complete the #1 test, the #2 one goes wrong

13th Jul 2021, 6:40 PM
Saood Aga
Saood Aga - avatar
14 Answers
+ 4
The program itself has one input. Each test case just tests your program with one specific value the input can take. The program also has one output. Each test case just checks whether your output, given some input, matches the expected result. Therefore, the backbone of your program could look like this: ... int main() { int numberOfPassengers = 0; int numberOfFreeSeats = 0; // take amount of passengers as input cin >> numberOfPassengers; // do calculations numberOfFreeSeats = ...; // print amount of free seats as output cout << numberOfFreeSeats; return 0; } You are now expected to come up with a general formula, given the variable "numberOfPassengers", that calculates the correct amount of free seats. You have already been given a hint how to do this. The program is then run for different values of "numberOfFreePassengers" as test cases. You should not make any assumptions about the specific value.
14th Jul 2021, 8:58 AM
Shadow
Shadow - avatar
+ 2
The number of passengers is automatically supplied to your program as input. You should have learned how to take input from the lessons. You have to accept this input in your program, and then print the number of remaining seats. Each test case constitutes a separate output, obtained by running your program with the designated input. As such, hardcoding the test values can only solve one test case at a time, but is never a general solution.
13th Jul 2021, 9:02 PM
Shadow
Shadow - avatar
+ 2
What 'x' and 'y' are you referring to? The transportation project only has a single input, the number of passengers.
14th Jul 2021, 8:16 AM
Shadow
Shadow - avatar
+ 1
Read input and output formats and check your code again is it valid for all input
13th Jul 2021, 6:49 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
If your code will correct according to inputs and outputs then all cases will work otherwise in different different inputs it will failed so click on test 2 and see what mistakes you doing
13th Jul 2021, 6:42 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
So.. should I find a code that will represent the output of all test's at once???
13th Jul 2021, 6:45 PM
Saood Aga
Saood Aga - avatar
0
I don't understand what you're trying to say 😅🥲
13th Jul 2021, 6:55 PM
Saood Aga
Saood Aga - avatar
0
Iam very confused, just help me out
13th Jul 2021, 6:55 PM
Saood Aga
Saood Aga - avatar
0
There are 2 outputs, how to put them in the same code?? And get the expected output??? outputs are also different
13th Jul 2021, 7:15 PM
Saood Aga
Saood Aga - avatar
0
Ahh!! 😅 .. how to solve the test #1 and #2 simultaneously
14th Jul 2021, 5:07 AM
Saood Aga
Saood Aga - avatar
0
Can you tell me what's x's value should be taken and y's value??
14th Jul 2021, 7:43 AM
Saood Aga
Saood Aga - avatar
0
It doesn't has a single intput, it has different intputs and that too different expected outputs
14th Jul 2021, 8:21 AM
Saood Aga
Saood Aga - avatar
0
Help me out plzz
14th Jul 2021, 8:21 AM
Saood Aga
Saood Aga - avatar
0
Thank you soo much for your efforts, appreciate it 🙌
14th Jul 2021, 6:22 PM
Saood Aga
Saood Aga - avatar