Help with Fatal Error C1075

Write your question here.

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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
  #include <iostream>
#include <string>
using namespace std;
char board [9];

void showBoard ();
bool moveIsValid (int m);
void main(){
	string player1Name;
	string player2Name;
	int playersTurn = 1;
	int move;

	board [0] = '0';
	board [1] = '1';
	board [2] = '2';
	board [3] = '3';
	board [4] = '4';
	board [5] = '5';
	board [6] = '6';
	board [7] = '7';
	board [8] = '8';

	cout << "Player 1: Enter your name." << endl;
	cin >> player1Name;
	cout << "Player 2: Enter your name." << endl;
	cin >> player2Name;
showBoard ();

if (playersTurn ==1){

	cout <<  player1Name << " make your move" << endl;
}else{
	cout <<  player2Name << " make your move" << endl;
}

cout << "chose a number" << endl;
cin >> move;

switch (playersTurn){

case (1):
	{
	playersTurn = 2;
	board[move] = 'x';
	break;
	}
case (2):
	{
	playersTurn = 1;
	board[move] = 'o';
	}
}
showBoard ();
}

void showBoard ();
	bool moveIsValid (int m)
	{
		if (board[m] != 'x')
		{
			return true;
		}
	else
		{
		return false;
		}
	}

	
{
	cout << endl;
	cout << board [0] << " | " << board [1] <<" | " << board [2] << endl;
	cout << "--+---+--" << endl;
	cout << board [3] << " | " << board [4] <<" | " << board [5] << endl;
	cout << "--+---+--" << endl;
	cout << board [6] << " | " << board [7] <<" | " << board [8] << endl;
	cout << endl;
}
	
	

My Error gives me this:
c:\users\megacrashgr\documents\visual studio 2010\projects\tic tac toe test\tic tac toe test 2\tic tac toe 2.cpp(71): error C2447: '{' : missing function header (old-style formal list?)

I know this error means a missing or misplaced bracket. But everytime I think I've fixed it, it gives me another error.

The error tells me it's on line 71, and it's expecting a declaration. How do I resolve this?
Move line 57 to 70 and remove semicolon here
Last edited on
Look at the braces. Line 59 and 68 form the body of moveIsValid.
When the compiler encounters the brace at line 68, it know the function is complete. It then sees the open brace at line 71 and doesn't know what to do with it. Are lines 72-78 part of moveIsValid? If so, get rid of lines 68 and 71. If not, where do those lines belong. They can;t stand by themselves.

Thank you sir!
@MiiNiPaa - and remove the ;
Topic archived. No new replies allowed.