Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- double distance;
- string time_of_day;
- cin >> distance;
- cin >> time_of_day;
- double taxi_initial_price = 0.7;
- double taxi_day_price = 0.79;
- double taxi_night_price = 0.9;
- double bus = 0.09;
- double train = 0.06;
- if (distance >= 100)
- {
- //Train
- cout << distance * train << endl;
- }
- else if (distance >= 20)
- {
- //Bus
- cout << distance * bus << endl;
- }
- else
- {
- //Taxi
- if (time_of_day == "day")
- {
- cout << taxi_initial_price + distance * taxi_day_price << endl;
- }
- else if (time_of_day == "night")
- {
- cout << taxi_initial_price + distance * taxi_night_price << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement