You seem to have problems with how the type identifiers are used. Here are a few errors which should be fixed:
On lines 55 and 56, you are not actually calling the functions, you are forward-declaring them locally. If you want to call them, remove the
string from in front of the function.
In your switch function, you are declaring a new local variable, which will override the global variables (which I presume you meant to modify). Also, due to the break statements, the return values will never be reached.
On your return statement on line 138, you are misunderstanding the comma operator. Here, you will simply return SQR1. You cannot return multiple values from a function.
Here is some things I would do:
Make your strings into an array of strings, and make your functions take arrays of strings as parameters. This would mean rather than calling SQR1, SQR2, etc... you would call squares[0], squares[1], etc... (or whatever you call the array). This could mean that you replace your switch functions to something like the following:
1 2 3 4 5 6 7 8 9 10 11 12
|
// void, because you don't need to return anything
// take an array of strings
void makeMoveN(std::string *squares) {
int pickSquare = 0;
// ...
while (pickSquare < 1 || pickSquare > 9) {
std::cout << "Enter square number [1-9]: ";
std::cin >> pickSquare;
}
square[pickSquare - 1] = "O";
}
|
This is a start, hope this helps!