Error: Expected ' ; ' before the constant

I'm getting the "Error: Expected ';' before the constant"
on line #31. I cant find the error. Thnx to anyone who reponds in advance.
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
 #include<iostream>

using namespace std;

int main()
{

    double numGrades, runtotal = 0;
    double myGrades[30];

    cout << "\n Enter # of grades?: "; //Step #1
    cin >> numGrades;

    for (int x = 1; x<= numGrades; x++) //Step #2(a)
    {
      do
      {
           cout << "\n Enter grade on test " << x << "? ";
           cin >> myGrades[x];

           if (myGrades[x] < 0)
           {
         cout << "\n Please enter a valid grade";
           }
      }
        while (myGrades[x] < 0);
        runtotal = runtotal + myGrades[x];
    }
        for (int y = 0; y <= numGrades; y++)
        {
            cout << "Your grades are:" << myGrades[y]"%"<<endl;

        }

        cout << "Your avg is: " << runtotal/numGrades;
        cout <<"\n\n";


    return 0;

}
Last edited on
closed account (Dy7SLyTq)
cout << "Your grades are:" << myGrades[y]"%"<<endl;
simple fix you forgot a << between the array cell and the string literal
Lol thnx alot
Topic archived. No new replies allowed.