Advertisement
Alina_C

Untitled

May 26th, 2022
730
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     cout << "Amount of cents: ";
  7.    
  8.     int usr_cent = 0;
  9.     cin >> usr_cent;
  10.    
  11.     int dollars, quarters, dimes, nickels, pennies;
  12.     dollars = quarters = dimes = nickels = pennies = 0;
  13.  
  14.     dollars = usr_cent / 100;
  15.     usr_cent -= dollars * 100;
  16.    
  17.     quarters = usr_cent / 25;
  18.     usr_cent -= quarters * 25;
  19.    
  20.     dimes = usr_cent / 10;
  21.     usr_cent -= dimes * 10;
  22.    
  23.     nickels = usr_cent / 5;
  24.     usr_cent -= nickels * 5;
  25.    
  26.     pennies = usr_cent;
  27.    
  28.     cout << "\nYou can provide the following change\ndollars: \t" << dollars << endl;
  29.     cout << "quarters: \t" << quarters << endl;
  30.     cout << "dimes: \t\t" << dimes << endl;
  31.     cout << "nickels: \t" << nickels << endl;
  32.     cout << "pennies: \t" << pennies << endl;
  33.     cout << endl;
  34.     return 0;
  35. }
  36.  
  37.  
Advertisement
RAW Paste Data Copied
Advertisement