+ 1

problem trying to put the answere in the correct test case.

hello, everyone. I need some help, because I solve the first problem from c++ transport , but the results are thaken together in the first part of the test, I try to separate them but then appears the first result in first one and in the second spaceand I can not put them apart. thank you sorry for my english and, I hope you can understand what i am trying to ask. The results appears together, or the first one in both spaces and put me its wrong. I dont know how to separate the anweres in the exercise to obteint the 2 parts completed ok #include<iostream> using namespace std; int main(){ int passengers1=12; int pass2=231; int leftpassengers1=passengers1%50; int emptyseats1=50-leftpassengers1; cout<<emptyseats1<<endl; int leftpassengers2=pass2%50; int emptys2=50-leftpassengers2; cout<<emptys2<<end1; return0; }

7th Jan 2021, 4:10 PM
Mireya Pena Carcamo
Mireya Pena Carcamo - avatar
6 Antworten
+ 1
Mireya Pena Carcamo Your program is missing the ability to take input from the user and operate on the input values. Instead of hard-coding input values, use cin (console input) to accept values from the user. Here is your code that I modified to use cin. #include<iostream> using namespace std; int main() {    int passengers;    cin >> passengers;    int leftpassengers = passengers%50;    int emptyseats = 50 - leftpassengers;    cout << emptyseats << endl;    return0; }
8th Jan 2021, 8:06 PM
Brian
Brian - avatar
+ 2
Mireya Pena Carcamo Post your code so that we could help
7th Jan 2021, 4:18 PM
Alphin K Sajan
Alphin K Sajan - avatar
+ 2
I think it's only asking to find empty seats so emptyseats1 calculations not needed. Try to Comment 1st cout, only output emptys2.
7th Jan 2021, 8:36 PM
Jayakrishna 🇮🇳
+ 1
thank you Brian. I have done it, and i solve the problem. thank you again.
8th Jan 2021, 10:05 PM
Mireya Pena Carcamo
Mireya Pena Carcamo - avatar
0
thankyou i will try that.
8th Jan 2021, 7:21 PM
Mireya Pena Carcamo
Mireya Pena Carcamo - avatar
0
Mireya Pena Carcamo you are welcome. Congratulations on solving the problem!
8th Jan 2021, 10:09 PM
Brian
Brian - avatar