Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- double coins;
- cout << "Hi! Please tell me the amount of money you have and I will tell you how much you have in change :)" << endl;
- cin >> coins;
- double quarter = 0;
- double dime = 0;
- double nickel = 0;
- double penny = 0;
- while (coins >= 25){
- quarter++;
- coins = coins - 25;
- }
- while (coins >= 10){
- dime++;
- coins = coins - 10;
- }
- while (coins >= 5){
- nickel++;
- coins = coins - 5;
- }
- while (coins >= 1){
- penny++;
- coins = coins - 1;
- }
- cout << "(Quaters: " << quarter << ", Dimes: " << dime << ", Nickels: " << nickel << ", Pennies: " << penny << ")" << endl;
- cout << "Thank you!";
- }
Add Comment
Please, Sign In to add comment