Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. int main()
  2. {
  3. int dollarValue; // number of dollars input
  4. int coinTotal; // number of coins after calculation
  5. char coinType; // option to specify coin type
  6.  
  7. std::cout "Welcome to Matt's Coin Converter\nHow many Dollars? (Enter -1 to quit)"; //Getting user input
  8.  
  9. std::cin = dollarValue; // Defining dollarValue variable
  10.  
  11. if dollarValue >= 1; // Check on positive value, also break point
  12.  
  13. std::cout "\nThank you, Which coin?\nP-Pennies\nN-Nickels\nD- Dimes\nQ-Quarters\nEnter your choice -->"; //Coin Choice from user
  14.  
  15. std::cin >> CoinType; // Depending on coin type, will go to corresponding calculation and display the result.
  16.  
  17. if coinType == "P";
  18.  
  19. coinTotal = dollarValue * 100;
  20. std::cout >> "\nThere are" << PennyTotal << "Pennies in" << dollarValue << "dollars.";
  21.  
  22. else
  23.  
  24. if coinType == "N";
  25.  
  26. coinTotal = dollarValue * 20;
  27. std::cout >> "\nThere are" << coinTotal << "Nickels in" << dollarValue << "dollars.";
  28.  
  29. else
  30.  
  31. if coinType == "D"
  32.  
  33. coinTotal = dollarValue * 10;
  34. std::cout >> "\nThere are" << DimeTotal << "Dimes in" << dollarValue << "dollars.";
  35.  
  36. else
  37.  
  38. if coinType == "Q";
  39.  
  40. coinTotal = dollarValue * 4;
  41. std::cout >> "\nThere are" << QuarterTotal << "Quarters in" << DollarValue << "dollars.";
  42.  
  43. else
  44.  
  45. end if
  46.  
  47. else
  48. error/quit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement