+ Нов въпрос
Aegon 0 Точки

## 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;
}

Къде съм сгрешил?

Тагове:
0
javor_tzvetkov8787 3 Точки

Направи първия вариант на string-а room само от една дума (да не е "room for one person", а например "regular" или нещо подобно).

0
20/10/2020 20:09:50
delhis 19 Точки

Best school teachers and staff greater noida

0
11/12/2020 17:04:24
delhis 19 Точки

Real Estate chapter during 2008 and learned a lot about each and every aspect of the sector like student and earned a reputation as a Professional real estate agent.

0
delhis 19 Точки

CS GO is one of the most popular multiplayer games at the moment.
csgo accounts

0
delhis 19 Точки
CSGO is a team game, and Trust Factor is a system to pair players with other similar players.
csgo smurf
0