Hey guys, this is my first post and I'm brand new to programming. My teacher is having me make an automated cash program that...
1. Only allows the user to enter a dollar amount up to a 100, the input is a double and decimal places are used to represent cents. If the user types in more than two decimal places, use an arithmetic expression to remove the extra places.
2. The 100 dollar limit must be enforced.
3. Once the dollar amount is entered, your program will compute and display the amount entered, followed by a proper breakdown of denominations that represent that dollar amount, using the largest denominations possible. The following denominations are used: 20, 10, 5, 1, .25, .10, .05, and .01.
4. If a denomination is not used, do not display that denomination at all.
5. Have your results read singular or plurar as appropriate.
6. After the breakdown has been output, ask the user if they want to enter another value to breakdown.
I having so much issues with this program and I feel like an idiot because I bet it's something easy. I was hoping you guys can take a look at it and put me off on the right foot. I appreciate with any help you can offer me. Here's my code.
in
Code:/*Change-o-Matic*/ #include <stdio.h> #include <math.h> int main(void) { /* List of Variables*/ double amtgiven; double twenty = 20.00; double ten = 10.00; double five = 5.00; double one = 1.00; double quarter = .25; double dime = .10; double nickle = .05; double penny = .01; printf("Please enter a dollar amount up to a hundered dollars: "); scanf("%lf", &amtgiven); /* To make sure the amount given stays under 100 dollars*/ while ((amtgiven < 0) || (amtgiven > 100)) { printf("The amount is out of range, please re-enter: ", amtgiven); scanf("%lf", &amtgiven); } return 0; }