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 ;/
#include<iostream>
#include<string>
#include<iomanip>
#include<cstdlib>
#include<ctime>
void MathGame();
void GuessingGame();
void TreasureGame();
void PsyhicGame();
usingnamespace 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
constint 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();
}
elseif (gameChoice == 2)
{
GuessingGame();
}
elseif (gameChoice == 3)
{
TreasureGame();
}
else
PsyhicGame();
}
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 ;/
#include<iostream>
#include<string>
#include<iomanip>
#include<cstdlib>
#include<ctime>
void MathGame();
void GuessingGame();
void TreasureGame();
void PsyhicGame();
usingnamespace 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
constint 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();
}
elseif (gameChoice == 2)
{
GuessingGame();
}
elseif (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