Error c1075 please help

I keep getting the error
Error C1075 the left brace '{' was unmatched at the end of the file at line 14. I cant find the error. There is more code but i only post the part i keep getting the error at. Any help will be appreciated

sorry for the long code ;/

P.S. I already tried adding a close bracket at the end of the main function but it it still giving me the error ;/

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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#include<iostream>
#include<string>
#include<iomanip>
#include<cstdlib>
#include<ctime>
void MathGame();
void GuessingGame();
void TreasureGame();
void PsyhicGame();
using namespace std;


int main()
{

	//declaring variables ( some for now, more later)

	int gameChoice;
	int choice;
	char border_char;
	string name;




	//prompting user to pick a char to be used for menu border

	cout << "Which character should be used for the menu border? ";

	cin >> border_char;


	//prompt user for his/her name

	cout << "What name should should be used to welcome the user? ";

	cin >> name;



	// printing out the whole menu and ask user to pick a menu choice

	const int WIDTH = 55;



	cout << '\n'

		<< setfill(border_char) << setw(WIDTH) << right << border_char << '\n'

		<< border_char << setfill(' ') << setw(WIDTH - 1) << border_char << '\n'

		<< border_char << ' ' << left << setw(WIDTH - 3) << "      Welcome, " + name + '!' << border_char << '\n'

		<< border_char << setfill(' ') << setw(WIDTH - 1) << right << border_char << '\n'

		<< border_char << ' ' << left << setw(WIDTH - 3) << "Please chose a number from the following options" << border_char << '\n'

		<< border_char << ' ' << left << setw(WIDTH - 3) << "1. Play the game" << border_char << '\n'

		<< border_char << ' ' << left << setw(WIDTH - 3) << "2. Demo the game" << border_char << '\n'

		<< border_char << ' ' << left << setw(WIDTH - 3) << "3. Exit" << border_char << '\n'

		<< border_char << setfill(' ') << setw(WIDTH - 1) << right << border_char << '\n'

		<< setfill(border_char) << setw(WIDTH) << right << border_char << "\n\n";



	// infinite loop variable

	bool cont = true;



	while (cont == true)

	{



		//prompt user for menu choice

		cout << "Which menu number choice you chose?";

		cin >> choice;

		cout << "\nYou have chosen: " << choice << '\n';



		// if usser choose to exit, program exits

		if (choice == 3)

			exit(0);



		// if user wants to demo the game, it explains him/her the guessing and math game

		if (choice == 2)

			cout << "For the Math game, you will choose a 5 digit number. Then the computer will generate a total sum sum for the following four 5 digit numbers you and the computer chooses. Then, after the given numbers, add them all up and compare it to the total sum given before!"

			<< "For the guessing game, the computer chooses a random number and its your job to guess it within three tries! Good Luck!\n";



		//if user choose to play the game it ask if they want to play the math or guessing game

		if (choice == 1)

		{

			cout << "Which game do you want to play?" << endl << "1. Math Game\n" << "2. Guessing game\n" << "3. Treasure game\n" << " 4. Psyhic game\n" << endl;

			cin >> gameChoice;

		}

		if (gameChoice == 1)
		{
			MathGame();

		}
		else if (gameChoice == 2)
		{
			GuessingGame();

		}
		else if (gameChoice == 3)
		{
			TreasureGame();
		}
		else
			PsyhicGame();
	}
Last edited on
If this doesn't sound like a silly question, did you try adding the missing right brace '}' at the end of the code?
yup i tried. i adding tht at the end of the main function code still same problem.
In fact, adding the bracket gave me TONS OF ERRORS MORE. Im gonna die soon ;/
Last edited on
closed account (E0p9LyTq)
chang123 wrote:
There is more code but i only post the part i keep getting the error at.

Many times the actual problem isn't where the compiler reports the error to be.

chang123 wrote:
adding the bracket gave me TONS OF ERRORS MORE.

And the errors might be?
Your main is missing a brace.

And a small tip.
1
2
3
4
5
6
else
	PsyhicGame();

if (choice == 3)

		exit(0);


Dont do this stuff, just use braces either way, even if it's just one line of code. That'll save you a lot of time and effort in the future.
Last edited on
This code compiles without error (though I've no idea whether it works).

I added these lines at the bottom:
140
141
142
143
144
145
}   // closing brace for main()

void MathGame() {}    // empty functions to clear the linker errors
void GuessingGame() {}
void TreasureGame() {}
void PsyhicGame() {}


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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#include<iostream>
#include<string>
#include<iomanip>
#include<cstdlib>
#include<ctime>
void MathGame();
void GuessingGame();
void TreasureGame();
void PsyhicGame();
using namespace std;


int main()
{

	//declaring variables ( some for now, more later)

	int gameChoice;
	int choice;
	char border_char;
	string name;




	//prompting user to pick a char to be used for menu border

	cout << "Which character should be used for the menu border? ";

	cin >> border_char;


	//prompt user for his/her name

	cout << "What name should should be used to welcome the user? ";

	cin >> name;



	// printing out the whole menu and ask user to pick a menu choice

	const int WIDTH = 55;



	cout << '\n'

		<< setfill(border_char) << setw(WIDTH) << right << border_char << '\n'

		<< border_char << setfill(' ') << setw(WIDTH - 1) << border_char << '\n'

		<< border_char << ' ' << left << setw(WIDTH - 3) << "      Welcome, " + name + '!' << border_char << '\n'

		<< border_char << setfill(' ') << setw(WIDTH - 1) << right << border_char << '\n'

		<< border_char << ' ' << left << setw(WIDTH - 3) << "Please chose a number from the following options" << border_char << '\n'

		<< border_char << ' ' << left << setw(WIDTH - 3) << "1. Play the game" << border_char << '\n'

		<< border_char << ' ' << left << setw(WIDTH - 3) << "2. Demo the game" << border_char << '\n'

		<< border_char << ' ' << left << setw(WIDTH - 3) << "3. Exit" << border_char << '\n'

		<< border_char << setfill(' ') << setw(WIDTH - 1) << right << border_char << '\n'

		<< setfill(border_char) << setw(WIDTH) << right << border_char << "\n\n";



	// infinite loop variable

	bool cont = true;



	while (cont == true)

	{



		//prompt user for menu choice

		cout << "Which menu number choice you chose?";

		cin >> choice;

		cout << "\nYou have chosen: " << choice << '\n';



		// if usser choose to exit, program exits

		if (choice == 3)

			exit(0);



		// if user wants to demo the game, it explains him/her the guessing and math game

		if (choice == 2)

			cout << "For the Math game, you will choose a 5 digit number. Then the computer will generate a total sum sum for the following four 5 digit numbers you and the computer chooses. Then, after the given numbers, add them all up and compare it to the total sum given before!"

			<< "For the guessing game, the computer chooses a random number and its your job to guess it within three tries! Good Luck!\n";



		//if user choose to play the game it ask if they want to play the math or guessing game

		if (choice == 1)

		{

			cout << "Which game do you want to play?" << endl << "1. Math Game\n" << "2. Guessing game\n" << "3. Treasure game\n" << " 4. Psyhic game\n" << endl;

			cin >> gameChoice;

		}

		if (gameChoice == 1)
		{
			MathGame();

		}
		else if (gameChoice == 2)
		{
			GuessingGame();

		}
		else if (gameChoice == 3)
		{
			TreasureGame();
		}
		else
			PsyhicGame();
	}
}

void MathGame() {}
void GuessingGame() {}
void TreasureGame() {}
void PsyhicGame() {}
Thanks Chervil and everyone who tried to help. I used Chervil modified version of my code and the terrible errors went away. Thanks Chervil and everyone and i hope the errors wont come back after i put the function definitions in. CHEERS AND GOD BLESS EVERYONES SOUL
Topic archived. No new replies allowed.