Guest User

Untitled

a guest
Dec 19th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. double coins;
  7. cout << "Hi! Please tell me the amount of money you have and I will tell you how much you have in change :)" << endl;
  8. cin >> coins;
  9.  
  10. double quarter = 0;
  11. double dime = 0;
  12. double nickel = 0;
  13. double penny = 0;
  14.  
  15. while (coins >= 25){
  16. quarter++;
  17. coins = coins - 25;
  18. }
  19. while (coins >= 10){
  20. dime++;
  21. coins = coins - 10;
  22. }
  23. while (coins >= 5){
  24. nickel++;
  25. coins = coins - 5;
  26. }
  27. while (coins >= 1){
  28. penny++;
  29. coins = coins - 1;
  30. }
  31. cout << "(Quaters: " << quarter << ", Dimes: " << dime << ", Nickels: " << nickel << ", Pennies: " << penny << ")" << endl;
  32. cout << "Thank you!";
  33. }
Add Comment
Please, Sign In to add comment