0
How to answers the different test cases in (transportation)test,iam confused. Once I complete the #1 test, the #2 one goes wrong
14 Antworten
+ 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.
+ 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.
+ 2
What 'x' and 'y' are you referring to? The transportation project only has a single input, the number of passengers.
+ 1
Read input and output formats and check your code again is it valid for all input
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
0
So.. should I find a code that will represent the output of all test's at once???
0
I don't understand what you're trying to say 😅🥲
0
Iam very confused, just help me out
0
There are 2 outputs, how to put them in the same code?? And get the expected output???
outputs are also different
0
Ahh!! 😅 .. how to solve the test #1 and #2 simultaneously
0
Can you tell me what's x's value should be taken and y's value??
0
It doesn't has a single intput, it has different intputs and that too different expected outputs
0
Help me out plzz
0
Thank you soo much for your efforts, appreciate it 🙌