# Thread: Change Conversion Homework Help

1. ## Change Conversion Homework Help

Hi, I have an assignment which have 10 questions and I managed to do 9½ of them. Question #6 has 2 parts to it. I managed to finish part a, but can't get part b to work. Please give me some assistance - thank you all in advance.

6. a. Write a program for a bank that allows the user to enter an amount of money in cents. Display the number of whole dollars the bank will give the customer in exchange. This is the solution I was able to compile

Code:
```#include<iostream>
using namespace std;

int main()
{

int cents = 0;
int dollar = 0;
cout << "Please enter the amount of money in cents:" << endl;
cin >> cents;
dollar = cents / 100;
cout << "the whole dollars amount in exchange is: " << dollar << endl << endl;

system("pause");
return 0;

}```
Part B is difficult for me:

b. Modify the program in 6a so that, in addition to the cents, the user enters the denomination of the coin to which to convert the pennies, such as 5 for nickels or 25 for quarters.

2. money = cents / 25;
if cents is 100 then you will get 4 quarters as expected.

So you will have to have the user input the denomination...

cin >> denomination;

then

money = cents / denomination.

3. Thanks, that worked. I guessed I overcomplicated things and tried to define a variable for nickel or quarters. Even though the code did work, I don't think my output sentence is correct, what do you think?

cout "The conversion amount is: <--- should I reword this?

Code:
```#include<iostream>
using namespace std;

int main()
{

int cents = 0;
int dollar = 0;
int denomination = 0;
int conversion = 0;
cout << "Please enter the amount of money in cents:" << endl;
cin >> cents;
cout << "Please enter the conversion in 5(nickels) or 25(quarters):" << endl;
cin >> denomination;
dollar = cents / 100;
conversion = cents / denomination;
cout << "The whole dollars amount in exchange is: " << dollar << endl << endl;
cout << "The conversion amount is: " << conversion << endl << endl;

system("pause");
return 0;

}```