fork download
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. const int FIFTY = 5000;
  7. const int TEN = 1000;
  8. const int QUARTER = 25;
  9. const int ONE = 1;
  10.  
  11. int /*_t*/main(/*int argc, _TCHAR* argv[]*/)
  12. {
  13. int change;
  14.  
  15. cout << "Enter the amount of money in your wallet: ";
  16.  
  17. cin >> change;
  18.  
  19. cout << endl;
  20.  
  21. cout << "The amount you entered is: " << change << endl;
  22.  
  23. cout << "You have this many Fifty dollars: " << change / FIFTY << endl;
  24. change = change % FIFTY;
  25.  
  26. //
  27. cout << "You have this many Ten dollars: " << change / TEN << endl;
  28. change = change % TEN;
  29.  
  30. //
  31. cout << "You have this many Quarters: " << change / QUARTER << endl;
  32. change = change % QUARTER;
  33.  
  34. //
  35. cout << "You have this many One: " << change / ONE << endl;
  36. change = change % ONE;
  37.  
  38. return 0;
  39. }
  40.  
Success #stdin #stdout 0s 3300KB
stdin
27
stdout
Enter the amount of money in your wallet: 
The amount you entered is: 27
You have this many Fifty dollars: 0
You have this many Ten dollars: 0
You have this many Quarters: 1
You have this many One: 2