Question: I need to fix my pogram. I need it fore intance if I type 99 cents to give me 3 quarters, two dimes and 4

I need to fix my pogram. I need it fore intance if I type 99 cents to give me 3 quarters, two dimes and 4 pennies... so far it does not give me a good output

I am not allow to use any fancy functions just normal beginner level C++ thank you so much ~

#include using namespace std;

int main() { int QUARTERS = 25; int DIMES = 10; int NICKELS = 5; int PENNIES = 1;

int change, numQuarters, numDimes, numNickels, numPennies;

cout << "Please enter an amount in cents less than a dollar." << endl; cin >> change;

numQuarters = change / QUARTERS; change = change - numQuarters;

numDimes = change / DIMES; change = change - numDimes;

numNickels = change / NICKELS; change = change - numNickels;

numPennies = change / PENNIES; change = change - numPennies;

cout << "Your change will be:"<< endl; cout << "Q: " << numQuarters << endl; cout << "D: " << numDimes << endl; cout << "N: " << numNickels << endl; cout << "P: " << numPennies << endl;

system("pause"); return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!