int main() and % syntax errors

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;

quotient=(n1/25);
remainder=n1%25;
quotient=(remainder/10);
remainder=nd%10;
quotient=(remainder/5);
remainder=nn%5;
quotient=(remainder/1);

cout<<"You have"<<nq<<" quarters, "<<nd<<" dimes, "<<nn<<" nickels, "<<np<<" pennies, which is a total of"<<n1<<" cents."<<endl;
}
Perhaps this discussion will help.

http://www.cplusplus.com/forum/beginner/43970/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// 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>

using namespace 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;

}

hope this helps
Topic archived. No new replies allowed.