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()
- {
- double whiskeyprice;
- cin >> whiskeyprice;
- double beer;
- do
- {
- cin.clear();
- cin >> beer;
- }
- while (cin.bad() || beer < 0 || beer> 10000);
- double wine;
- do
- {
- cin.clear();
- cin >> wine;
- } while (cin.bad() || wine < 0 || wine> 10000);
- double brandy;
- do
- {
- cin.clear();
- cin >> brandy;
- } while (cin.bad() || brandy< 0 || brandy > 10000);
- double whiskey;
- do
- {
- cin.clear();
- cin >> whiskey;
- } while (cin.bad() || whiskey < 0 || whiskey> 10000);
- double brandyprice = whiskeyprice / 2;
- double wineprice = brandyprice *0.6;
- double beerprice = brandyprice * 0.2;
- double sum = beerprice*beer + wineprice*wine + brandyprice*brandy + whiskeyprice*whiskey;
- cout << fixed << setprecision(2) << sum << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement