Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- double roomPrice = 18;
- double apartmentPrice = 25;
- double presidentApartmentPrice = 35;
- int days;
- string roomType;
- string rate;
- cin >> days;
- cin.ignore();
- getline(std::cin, roomType);
- cin >> rate;
- //getline(std::cin, rate);
- days = days - 1;
- double price = 18;
- if (roomType == "apartment") {
- if (days < 10) {
- price = apartmentPrice * 0.70;
- }
- else if (days <= 15) {
- price = apartmentPrice * 0.65;
- }
- else {
- price = apartmentPrice * 0.50;
- }
- }
- else if (roomType == "president apartment") {
- if (days < 10) {
- price = presidentApartmentPrice * 0.90;
- }
- else if (days <= 15) {
- price = presidentApartmentPrice * 0.85;
- }
- else {
- price = presidentApartmentPrice * 0.80;
- }
- }
- if (rate == "positive") {
- price *= 1.25;
- }
- else {
- price *= 0.90;
- }
- cout.setf(ios::fixed);
- cout.precision(2);
- cout << days * price;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement