//Jacklyn Isordia CSC5 Chapter 4, P. 221, #08
//
/**************************************************************
*
* Calculate the number of coins to get exactly one dollar
* ____________________________________________________________
*
* This program asks the user to enter a number of coins to make
* exactly one dollar. This includes pennies, nickels, dimes,
* and quarters when entered the correct amount of a single
* dollar the program will output a 'congratulations you've
* won! output.
* ____________________________________________________________
* INPUT
* pennies : number of pennies entered
* nickels : number of nickels entered
* dimes : number of dimes entered
* quarters : number of quarters entered
*
* OUTPUT
* total : displays win message if exactly $1.00 displays
* try again if over or under $1.00
*
* Formula
* total = (pennies *1) + (nickels * 5) + (dimes * 10) + (quarters * 25)
*
**************************************************************/
#include <iostream>
using namespace std;
int main() {
int pennies;
int nickels;
int dimes;
int quarters;
int total;
cout << "Enter the number of pennies\n";
cin >> pennies;
cout << "Enter the number of nickels\n";
cin >> nickels;
cout << "Enter the number of dimes\n";
cin >> dimes;
cout << "Enter the number of quarters\n";
cin >> quarters;
total = (pennies * 1) + (nickels * 5) + (dimes * 10) + (quarters * 25);
if (total == 100) {
cout << "Congratulations you've won!\n";
}
else if (total > 100) {
cout << "Try again, you've went over the dollar amount.\n";
}
else {
cout << "Try again, you've went under the dollar amount.\n";
}
return 0;
}