Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- int dollarValue; // number of dollars input
- int coinTotal; // number of coins after calculation
- char coinType; // option to specify coin type
- std::cout "Welcome to Matt's Coin Converter\nHow many Dollars? (Enter -1 to quit)"; //Getting user input
- std::cin = dollarValue; // Defining dollarValue variable
- if dollarValue >= 1; // Check on positive value, also break point
- std::cout "\nThank you, Which coin?\nP-Pennies\nN-Nickels\nD- Dimes\nQ-Quarters\nEnter your choice -->"; //Coin Choice from user
- std::cin >> CoinType; // Depending on coin type, will go to corresponding calculation and display the result.
- if coinType == "P";
- coinTotal = dollarValue * 100;
- std::cout >> "\nThere are" << PennyTotal << "Pennies in" << dollarValue << "dollars.";
- else
- if coinType == "N";
- coinTotal = dollarValue * 20;
- std::cout >> "\nThere are" << coinTotal << "Nickels in" << dollarValue << "dollars.";
- else
- if coinType == "D"
- coinTotal = dollarValue * 10;
- std::cout >> "\nThere are" << DimeTotal << "Dimes in" << dollarValue << "dollars.";
- else
- if coinType == "Q";
- coinTotal = dollarValue * 4;
- std::cout >> "\nThere are" << QuarterTotal << "Quarters in" << DollarValue << "dollars.";
- else
- end if
- else
- error/quit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement