Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <iostream>
- using namespace std;
- float convertAmountOwed(string amountOwed);
- float convertAmountPaid(string amountPaid);
- bool checkifShort(float amountOwed, float amountPaid);
- void performCalculation(float amountOwed, float amountPaid);
- int main()
- {
- string amountOwed;
- string amountPaid;
- cout << "Total Amount Owed" << '\n' << "$";
- cin >> amountOwed;
- cout << "Amount Paid" << '\n' << "$";
- cin >> amountPaid;
- float amountO = convertAmountOwed(amountOwed);
- float amountP = convertAmountPaid(amountPaid);
- if (checkifShort(amountP, amountO)) {
- cout << "You still owe: $" << amountO - amountP << '\n';
- }
- else {
- cout << "---------------------------" << '\n';
- performCalculation(amountO, amountP);
- cout << '\n' << "---------------------------" << '\n';
- }
- system("pause");
- return 0;
- }
- float convertAmountOwed(string amountOwed) {
- float amountO = std::stof(amountOwed);
- return amountO;
- }
- float convertAmountPaid(string amountPaid) {
- float amountP = std::stof(amountPaid);
- return amountP;
- }
- bool checkifShort(float amountPaid, float amountOwed) {
- return (amountPaid < amountOwed);
- }
- void performCalculation(float amountOwed, float amountPaid) {
- float amountChange = amountPaid - amountOwed;
- cout << amountChange;
- while (amountChange != 0) {
- if (amountChange - 100 !=0) {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement