Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main()
- {
- float haveMoney{ 0 };
- float cost{ 0 };
- std::cout << "Enter money sum you have\n";
- std::cin >> haveMoney;
- std::cout << "Enter cost of goods you witsh to buy\n";
- std::cin >> cost;
- if (cost >= 2000)
- {
- std::cout << "Cost with discount is " << cost * 0.9 << '\n';
- if (cost * 0.9 > haveMoney)
- {
- std::cout << "Oops! You haven't enough money to pay!\n";
- std::cout << "Find another " << cost * 0.9 - haveMoney << " $$$ and try again!\n";
- }
- else
- {
- std::cout << "You have enough money!\n Cost with discount is " << cost * 0.9 << '\n';
- }
- }
- else if ( cost >= 1500)
- {
- std::cout << "Cost with discount is " << cost * 0.93 << '\n';
- if (cost * 0.93 > haveMoney)
- {
- std::cout << "Oops! You haven't enough money to pay!\n";
- std::cout << "Find another " << cost * 0.93 - haveMoney << " $$$ and try again!\n";
- }
- else
- {
- std::cout << "You have enough money!\n Cost with discount is " << cost * 0.93 << '\n';
- }
- }
- else if (cost >= 1000)
- {
- std::cout << "Cost with discount is " << cost * 0.95 << '\n';
- if (cost * 0.95 > haveMoney)
- {
- std::cout << "Oops! You haven't enough money to pay!\n";
- std::cout << "Find another " << cost * 0.95 - haveMoney << " $$$ and try again!\n";
- }
- else
- {
- std::cout << "You have enough money!\n Cost with discount is " << cost * 0.95 << '\n';
- }
- }
- else
- {
- std::cout << "Cost WITHOUT discount is " << cost << '\n';
- if (cost > haveMoney)
- {
- std::cout << "Oops! You haven't enough money to pay!\n";
- std::cout << "Find another " << cost - haveMoney << " $$$ and try again!\n";
- }
- else
- {
- std::cout << "You have enough money!\n";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement