Need help with syntax (code inside).

The topic says it all. The line with the error is this:

SetUpAndWelcome(seedNumber, rollNumber, index, rollArray[]);.

What the compiler says is: Syntax error: ']'. Any help or ideas on how to fix this would be highly appreciated.

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
#include <iostream>  // for cin and cout
#include <iomanip>   // for setprecision

using namespace std;

int main()
{
     //Function Prototypes
     void SetUpAndWelcome(int&, int&, int, int);

     //Variables
     int seedNumber;
     int rollNumber;
     int index;
     int rollArray[11];

     SetUpAndWelcome(seedNumber, rollNumber, index, rollArray[]);
     return 0;
}
     void SetUpAndWelcome(int& seedNumber, int& rollNumber, int index, int rollArray[])
     {
     cout.setf(ios::fixed, ios::floatfield);

     while (index < 11)
     {
	rollArray[index] = 0;
	index++;
     }

     cout << "Hyperion's Mass Dice Roller V1.1 Loaded" << endl;
     cout << "This program allows a user to simulate mass dice rolling." << endl;
     cout << "Enter a random seed number: " << endl;
     cin >> seedNumber;
     cout << "How many times would you like to roll? " << endl;
     cin >> rollNumber;
     cout << "Simulating rolls.  Please wait." << endl << endl;
     return;
}


edit: Thought post was too long, and fixed something.
Last edited on
Make sure to prototype the function properly:
void SetUpAndWelcome(int&, int&, int, int[]);

and call the function properly:
SetUpAndWelcome(seedNumber, rollNumber, index, rollArray);

By the way, you never initialize 'index' before you use it.

Hope this helps.
Topic archived. No new replies allowed.