Array function help

I am writing a program for a lottery array function thing. I am getting this error in one of my functions and I have no idea what I am doing wrong. Please help.

[Error] expected ';' before ')' token

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

 void printWinners( int winArray[], int userArray[], int numValues )
    {
        double prizeArray[6]={0.00,1.00,5.00,10.00,20.00,25.00};
        
        int matches=0,i,j;
        
        cout << "The winning numbers are ";
        
        for (i=0, i < numValues, i++ )  //this is where i am getting the error
        {
            cout << winArray[i];
        }
        
        for (i=0, i < MAX_NUM, i++)
        {
            for (j=0, j < MAX_NUM , j++)
            {
                if ( winArray[i] == userArray[j])
                {
                     match++;                     
                }
            }
        }
        cout << "You matched " << match << "numbers. You win " << prizeArray[match];
        
    }
What you have on line 10:
for (i=0, i < numValues, i++ )

The for-loop syntax expects semi-colons (;), not commas:

for (i = 0; i < numValues; ++i)
Last edited on
oh wow thanks. you sir are a gentleman and a scholar.
Topic archived. No new replies allowed.