Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- //ягоди, банани, портокали и малини
- //цена и количество
- //1. сума за ягодите = цена на ягодите/кг * количество -> DONE
- //2. сума за малини = цена за малини/кг * количество -> DONE
- //3. сума за банани = цена на банани/кг * количество -> DONE
- //4. сума за портокали = цена за портокали/кг * количество -> DONE
- //сума = сума от ягодите + сума от банани + сума от портокали + сума от малини
- double strawberryPrice, bananaQuantity, orangeQuantity, raspberryQuantity, strawberryQuantity;
- cin >> strawberryPrice >> bananaQuantity >> orangeQuantity >> raspberryQuantity >> strawberryQuantity;
- //ЯГОДИ
- double strawberrySum = strawberryPrice * strawberryQuantity;
- //МАЛИНИ
- double raspberryPrice = strawberryPrice / 4;
- double raspberrySum = raspberryPrice * raspberryQuantity;
- //БАНАНИ
- double bananaPrice = raspberryPrice - 0.8 * raspberryPrice; //0.2 * raspberryPrice
- double bananaSum = bananaPrice * bananaQuantity;
- //ПОРТОКАЛИ
- double orangePrice = 0.6 * raspberryPrice; // raspberryPrice - 0.4 * raspberryPrice;
- double orangesSum = orangePrice * orangeQuantity;
- double totalSum = strawberrySum + raspberrySum + bananaSum + orangesSum;
- cout.setf(ios::fixed);
- cout.precision(2);
- cout << totalSum << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment