0

I need help with the first C++ coding challenge

I believe I have the right code because the output matches the results I output however it is still finding errors somehow. I am not sure what is wrong. #include <iostream> using namespace std; int main() { //your code goes here int passTotal; int busLoad = 50; cout << "Please enter the number of passemgers waiting"; cin >> passTotal; int seatsLeft = busLoad - passTotal % 50; cout << "There are " << seatsLeft << " seats left on the bus"; return 0; }

16th Nov 2021, 1:26 PM
Brian
7 Réponses
+ 5
You need to print only the number of seats left. I mean, cout << seatsLeft;
16th Nov 2021, 1:36 PM
Simba
Simba - avatar
+ 1
You can see clearly there that it asking to print only 'seatsLeft'. None of any extra charecters..!!! Comment or remove 1st and 2nd couts and Brian put just cout<<seats left;
16th Nov 2021, 1:50 PM
Jayakrishna 🇮🇳
0
Pls post problem description also. Along with your expected output and your output... Is it code coach problem?
16th Nov 2021, 1:37 PM
Jayakrishna 🇮🇳
0
Yes, it is a code coach problem. Test case 1: input 12, my output: Please enter the number of passengers waiting38 expected output: 38 test case 2: input: 231 my output: Please enter the number of passengers waiting19 output: 19
16th Nov 2021, 1:46 PM
Brian
0
Brian Just print value because test cases only understand that. Wherever you have written except value doesn't understand.
16th Nov 2021, 1:46 PM
A͢J
A͢J - avatar
0
Brian Your code is right except other printed text.
16th Nov 2021, 1:48 PM
A͢J
A͢J - avatar
0
Check the comments if the challenge man , you'll find more help there
17th Nov 2021, 12:35 AM
Zakaria AKTOUF
Zakaria AKTOUF - avatar