- 2
My project of transportation problem not accomplished
I need help please on the first project
4 Respostas
+ 3
Athbat what exactly have you tried ? Please show us your attempt.
At the moment your question is unanswerable and could lead to someone simply giving you their answer and how would that help you understand basic concepts.
You are making a program for a bus service.
A bus can transport 50 passengers at once.
Given the number of passengers waiting in the bus station as input, you need to calculate and output how many empty seats the last bus will have.
Sample Input:
126
Sample Output:
24
Explanation: The first bus will transport 50 passengers, leaving 126-50=76 in the station. The next one will leave 26 in the station, thus, the last bus will take all of the 26 passengers, having 50-26=24 seats left empty.
c++ end of module project ( self evaluation before moving on into more complexities )
+ 3
Athbat
don't include all those cout(s) in the code as the code simply wanted the number not the history of how you arrived at the number
#include <iostream>
using namespace std;
int main(){
int bus = 50;
int passengers;
cin >> passengers;
int x = passengers%bus;
int empty_seats = bus - x;
cout << empty_seats<<endl;
return 0;
}
0
#include <iostream>
2 using namespace std; 3
4 int main() {1/your code goes here int passenger
int remainpassenger;
int remainseats;
int numberofseats;
cout<< "enter number of passenger"<<endl; cin>>passenger,
cout<<" enter numberofseats"<<endl; cin>>numberofseats;
remainpassenger passenger%numberofseats; remainseats =numberofseats -remainpassenger; cout<<"remainseats are"<<endl ;return 0;
- 1
Member of sololearn