I keep getting a expected primary expression on the lines with the player position function and the cin >> position. I have read that this is due to missing semicolons or brackets but am not sure as to where the problem is. I have tried commenting out this code from the complete program and it compiled with no issues whatsoever. Any help would be most appreciated by a beginner.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
while (winner == "No")
{
if (repeat2 == "No")
{
cout << "Player 1 choose a square";
cin >> position;
player1_position(position);
}
elseif(repeat1 == "No")
{
cout << "Player 2 choose a square";
cin >> position;
player2_position(position);
}
}
Yes this is only part of the program. I have declared the variable "position" as an integer (int) type and it is a global variable declared at the start of the program after using namespace std;.