My project of transportation problem not accomplished | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
- 2

My project of transportation problem not accomplished

I need help please on the first project

2nd May 2022, 1:50 AM
Athbat
Athbat - avatar
4 Réponses
+ 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 )
2nd May 2022, 5:35 AM
BroFar
BroFar - avatar
+ 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; }
2nd May 2022, 6:05 AM
BroFar
BroFar - avatar
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;
2nd May 2022, 5:50 AM
Athbat
Athbat - avatar
- 1
Member of sololearn
2nd May 2022, 3:55 AM
Athbat
Athbat - avatar