# Thread: I need Help with this homework?

1. ## I need Help with this homework?

Help. can anyone make this work correctly. It suppose to ask for amount due, then payment is made and it should tell how much change is due in dollars, quarters, dimes, nickles and pennies
Code:
```#include <iostream>
using namespace std;

int main()
{
int owe = 0.0;
int paid = 0.0;
int change = 0.0;
int dollar = 0 ;
int quarter = 0 ;
int dime = 0 ;
int nickle = 0;
int penny = 0;

//enter input items
cout << "Enter Amount Owed: " ;
cin >> owe;
cout << "Enter Amount Paid: " ;
cin >> paid;

//calculate total owed in change
change = paid - owe;
dollar = change / 1;
quarter = (change - dollar) / .25;
dime = (change - dollar - (quarter * .25)) / .1;
nickle = (change - dollar - (quarter * .25) - (dime * .1)) / .05;
penny = (change - dollar - (quarter * .25) - (dime * .1) - (nickle * .05))
/ .01;

//display output items
cout << "change: " << change << endl;
cout << "dollar(s): " << dollar << endl;
cout << "quarter(s): " << quarter << endl;
cout << "dime(s): " << dime << endl;
cout << "nickel(s): " << nickle << endl;
cout << "penny(s): " << penny << endl;

return 0;
}```

2. Int = Integers which are whole numbers

Which of those do you need the number to be a whole number and which do you need to make it have decimals.

Popular pages Recent additions