Ski trip 9та задача от conditional statements
#include <iostream>
using namespace std;
//Не знам как става 9та
int main()
{
system("chcp 1251");
int days;
string room;
string rating;
cin >> days >> room >> rating;
cout.setf(ios::fixed);
cout.precision(2);
double discount;
double price;
double finalPrice{};
if (room == "room for one person")
{
price = 18.00;
if (days <= 10) discount = 0;
else if (days > 10 && days <= 15) discount = 0;
else if (days > 15) discount = 0;
if (rating == "positive") finalPrice = price * days - price + finalPrice * 0.25;
else if (rating == "negative") finalPrice = price * days - price - finalPrice * 0.10;
}
else if (room == "apartment")
{
price = 25.00;
if (days < 10) discount = 0.3 * finalPrice;
else if (days > 10 && days <= 15) discount = 0.35 * finalPrice;
else if (days > 15) discount = 0.5 * finalPrice;
if (rating == "positive") finalPrice = price * days - price + finalPrice * 0.25;
else if (rating == "negative") finalPrice = price * days - price - finalPrice * 0.10;
}
else if (room == "president apartment")
{
price = 35.00;
if (days < 10) discount = 0.1 * finalPrice;
else if (days > 10 && days <= 15) discount = 0.15 * finalPrice;
else if (days > 15) discount = 0.2 * finalPrice;
if (rating == "positive") finalPrice = price * days - price + finalPrice * 0.25;
else if (rating == "negative") finalPrice = price * days - price - finalPrice * 0.10;
}
cout << finalPrice << endl;
return 0;
}
Къде съм сгрешил?