Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # include <iostream>
- using namespace std;
- #include <iomanip>
- #include <math.h>
- #include <cmath>
- int main()
- {
- string city;
- double value;
- cin >> city;
- cin >> value;
- if (value >= 0 && value <= 500)
- {
- if (city == "Sofia")
- {
- cout << fixed << setprecision(2) << (value * 0.05) << endl;
- }
- else if (city == "Varna")
- {
- cout << fixed << setprecision(2) << (value * 0.045) << endl;
- }
- else if (city == "Plovdiv")
- {
- cout << fixed << setprecision(2) << (value * 0.055) << endl;
- }
- else
- {
- cout << "error" << endl;
- }
- }
- if (value > 500 && value <= 1000)
- {
- if (city == "Sofia")
- {
- cout << fixed << setprecision(2) << (value * 0.07) << endl;
- }
- else if (city == "Varna")
- {
- cout << fixed << setprecision(2) << (value * 0.075) << endl;
- }
- else if (city == "Plovdiv")
- {
- cout << fixed << setprecision(2) << (value * 0.08) << endl;
- }
- else
- {
- cout << "error" << endl;
- }
- }
- if (value > 1000 && value <= 10000)
- {
- if (city == "Sofia")
- {
- cout << fixed << setprecision(2) << (value * 0.08) << endl;
- }
- else if (city == "Varna")
- {
- cout << fixed << setprecision(2) << (value * 0.1) << endl;
- }
- else if (city == "Plovdiv")
- {
- cout << fixed << setprecision(2) << (value * 0.12) << endl;
- }
- else
- {
- cout << "error" << endl;
- }
- }
- if (value > 10000)
- {
- if (city == "Sofia")
- {
- cout << fixed << setprecision(2) << (value * 0.12) << endl;
- }
- else if (city == "Varna")
- {
- cout << fixed << setprecision(2) << (value * 0.13) << endl;
- }
- else if (city == "Plovdiv")
- {
- cout << fixed << setprecision(2) << (value * 0.145) << endl;
- }
- else
- {
- cout << "error" << endl;
- }
- }
- if (value<0)
- {
- cout << "error" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement