I am new to this whole programming thing. I have until 10:00pm CST tonight to have this program submitted to my professor, but can't figure out what I have done wrong.
The program is designed to take a number between 1&99 (to represent coins) and display how many quarters, dimes, nickels, and pennies.
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int quarters=25, dimes=10, nickels=5, pennies=1, n1, sum, %;
int nq=25, nd=10, nn=5, np=1;
int quotient;
int remainder;
cout<<"Please enter a number a number between 1 and 99."<<endl;
cin>>n1;
cout<<"The amount of money you entered is"<<n1<<"."<<endl;
// The program is designed to take a number between 1&99 (to represent coins) and display how many quarters, dimes, nickels, and pennies.
#include <iostream>
usingnamespace std;
int main()
{
int q = 0; // quarter
int d = 0; // dime
int n = 0; // nickel
int p = 0; // penny
int total = 0;
cout << "Please enter a number between 1 and 99 and press ENTER: ";
cin >> total;
if (total > 99){
cout << total << " is greater than 99!\nExiting...\n";
return 0;
}
while (true){
if (total >= 25){
q = total / 25;
total %= 25;
}
if (total >= 10){
d = total / 10;
total %= 10;
}
if (total >= 5){
n = total / 5;
total %= 5;
}
if (total > 0)
p = total / 1;
break;
}
cout << "You have " << q << " quarters " << d << " dimes ";
cout << n << " nickles and " << p << " pennies. (-:\n";
cin.get();
return 0;
}