+ 3
Transportation quiz
I have no idea how to write the answer in the c++ language
5 odpowiedzi
+ 2
As for some feedback to the question I thought we were trying to take x= 126 % 50. Then 50 - x to solve the specific question and problem. I didn't understand that the bus station wanted to input whatever number they wanted to get the remainder of seats. So the results saying "input num, your output, expected output. Was like HUH? What the?
Now I come here and read all I needed was Cin and let the user input a value and everything is all fixed up with the perfect end result.
+ 2
first try to understand the question items of logic and math
#include <iostream>
using namespace std;
int main() {
//your code goes here
int v=50;
int y;
cin >> y;
int z=50-(y%50);
cout << z;
return 0;
}
0
Try to understand this:
#include <iostream>
using namespace std;
int main() {
//your code goes here
int waitingpassangers;
cin >> waitingpassangers;
int buscapacity = 50;
int peopleinthelastbus = waitingpassangers % buscapacity;
int emptyseats = 50 - peopleinthelastbus;
cout << emptyseats;
return 0;
}
0
This was my answer.
Remember to add the ‘cin’ so that the run tests can input their values.
It took me several tries but this runs!
#include <iostream>
using namespace std;
int main() {
int station;
cin >> station;
int emptyBus = 50;
int lastBus = station%=50;
cout << (50-lastBus);
return 0;
}
0
Here is my code.
#include <iostream>
using namespace std;
int main() {
//your code goes here
int passengers;
cin >> passengers ;
int seat = passengers % 50;
if(passengers >= 50) {
if(seat > 50) {
cout << seat << endl;
}
}
if(seat < 50) {
cout << 50 - seat << endl;
}
return 0;
}