- 5
Who has solved the Transportation problem under the Cpp..Its confusing me.. Any help please đ
10 Answers
+ 1
Please show us first your attempt, or if you have one, please share it so we may help. Thanks.
Here are hints:
https://www.sololearn.com/Discuss/2655123/?ref=app
+ 1
Don Full
In challenges, you need to get the input. The reason why, is so that whatever the input may be, your code will work and will satisfy the expected output.
To get input in C++
cin >> variable;
where cin means console in.
+ 1
Here is the fix đ
https://code.sololearn.com/cpVFOAMlRT70/?ref=app
See ă Nicko12 ă 's answer for details.
+ 1
Wow how did I miss the cin>>
Thank you
Anytime I input a variable I must use the cin right?
+ 1
A simple three lines of code implementation.
First, you use the modulus function to find the remainder, which are the passengers on the last bus.
Then, to find the empty seats, you use bus capacity minus away the last passengers.
https://code.sololearn.com/cAsIKRZH3quK/?ref=app
0
Your attempt is needed
0
#include <iostream>
using namespace std;
int main()
{
int passenger = 126;
int bus =50;
int first = passenger % bus;
int second = bus - first;
cout <<second<<endl;
return 0;
}
0
Why do i feel like the problem is not solved? Can anyone explain to me what happened in this problem?
- 1
Always use "cin >>" in C++.
Visit :-
https://code.sololearn.com/cA96a2994a21
Solution :-
#include <iostream>
using namespace std;
int main() {
//your code goes here
int input;
cin >> input;
cout << 50 - input % 50;
return 0;
}