Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- double budget;
- cin >> budget;
- int gpu, cpu, ram;
- cin >> gpu >> cpu >> ram;
- int gpuPrice = gpu * 250;
- double cpuPrice = cpu * gpuPrice * 0.35;
- double ramPrice = ram * gpuPrice * 0.10;
- double totalPrice = gpuPrice + cpuPrice + ramPrice;
- if (gpu > cpu) {
- totalPrice *= 0.85;
- }
- cout.setf(ios::fixed);
- cout.precision(2);
- if (budget >= totalPrice) {
- cout << "You have " << budget - totalPrice << " leva left!" << endl;
- }
- else {
- cout << "Not enough money! You need " << totalPrice - budget << " leva more!" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement