   Simple Text Based Game (Brace Error?)  Error
#include <iostream>#include <windows.h>#include <string>using namespace std;// ===ints===int gold = 10;int lvl;int strength;int agility;int intelligence;int HP;int MP;int ItemID[];int MonsterID[99];int attack;int defense;int Maxlvl = 99;// ===floats===float XP;//===strings===string MonsterName[99];string ItemName[99];string Options;string YesNo;const string GameName = "Heroes of Ishara";//===bool===bool GameStartMenu = true;bool MainGame = false;bool OptionLoop = true;// Seting up WaitSec()inline void WaitSec(int seconds){    Sleep(seconds * 1000);}int main (){  WaitSec(1);  cout << "_-*^*-_Welcome to " << GameName << "_-*^*-_";  WaitSec(3);  cout << "\n\nChoose One of the following options:\n\n";  WaitSec(2);  cout << "New Game\nExit\n\n";  getline (cin, Options);  if (Options == "New Game"){  cout << "\nLoading...\n";  GameStartMenu = false;  }  if (Options == "Exit"){  return 0;  }  if (Options != "New Game" && Options != "Exit"){  cout << "\nPlease Enter only New Game or Exit";  cout << "\nThe application will now exit. Please restart.";  WaitSec(3);  return 0;  }  if (GameStartMenu == false) {  WaitSec(1);  cout << "\nGame Loaded\n";  WaitSec(3);  cout << "...";  WaitSec(1);  cout << "\n\nYou are sleeping like any ordinary day. You are sleeping happily when you friend, Lucas, comes in and starts yelling.\n";  WaitSec(5);  cout << "\nLucas: Hey wake up! Its the 21st of Ishtra! You know what that means? There is that festival at the royal castle!\n";  WaitSec(5);  cout << "\nYou sigh as you always do on the 21st of Ishtra. Every year the royal empire of Ishara celebrates their annual Victory of Ishara.\n";  WaitSec(5);  cout << "\nIshara is the name of the land that houses the Royal Empire of Ishara. The Royal Empire gets its name from the land.\n";  WaitSec(5);  cout << "\nThe empire was fighting a horde of dark elves that had a wicked ruler, Lich. Lich was a cruel ruler who would kill everyone in his path, even his own kind\n";  WaitSec(5);  cout << "\nThe first king of the empire, Remeis, used the sacred sword of Mars to slay Lich. Lich was sealed into the Temple of Echos, a temple filled of all the spirits in the land of Ishara\n";  WaitSec(5);  cout << "\nThe dark elves then withered away over time. Only a handful of dark elves are left in the world today, at least, thats what it said on the ancient scrolls writen by Remeis himself\n";  WaitSec(5);  cout << "\nLucas: Hurry up and grab your stuff, especially your sword! The're holding a wooden sword duel again! This time I just know I'll win!\n";  WaitSec(5);  cout << "\nLucas runs out of your room and down towards the castle. You put on your under garnments your tunic and you grab your sword. You open the door to your house and you feel like it is going to be any other ordinary event, but you hear thunder rumble in the far distance\n";  WaitSec(5);  cout << "\nYou think it is your imagination, but you have a bad feeling about today. You wonder to yourself if the dark elves really are gone...\n\n";  system("pause");  cout << " \n\nWhere do you wish to go?\n\n";  while (OptionLoop != false){  WaitSec(3);  cout << "Castle\nTown\nForest\nBeach\nExit";  getline (cin, Options);  if (Options == "Castle"){  OptionLoop = false;  }  if (Options == "Town"){  cout << "\nThe town is filled with laughing and happy people celebrating. You better go find Lucas at the Castle...\n";  }  if (Options == "Forest"){  cout << "\nYou hear monsters deep within the forest... However guards stop you from entering. You better go find Lucas at the Castle...\n";  }  if (Options == "Beach"){  cout << "\nYou see the wide spread sea. The light refelcts off of the gentle waves that flow to the shore. However you already know that there are monsters lurking inside the sea. You better go find Lucas at the Castle...\n";  }  if (Options == "Exit"){  cout << "\n\nAre you sure you wish to exit? You cannot save or load this game data!\n\n";  if (YesNo == "Yes"){return 0;  }  }  if (Options != "Castle" && Options != "Town" && Options != "Forest" && Options != "Beach" && Options != "Exit"){  cout << "\n\nError, not an option.\n\n";  }  }    return 0;  }This gives me this error:1>c:\documents and settings\brian nasser\my documents\visual studio 2008\projects\text based game 1\text based game 1\main.cpp(115) : fatal error C1075: end of file found before the left brace '{' at 'c:\documents and settings\brian nasser\my documents\visual studio 2008\projects\text based game 1\text based game 1\main.cpp(38)' was matchedWhat am i doing wrong?[Edited by - Zahlman on May 25, 2009 7:24:42 PM]
  You're missing a closing brace. Probably right before the return 0;. Ctrl+K, Ctrl+F in Visual Studio is your pal.   ;  Well, you have 14 opening curley braces, but only 13 closing ones. That can't be right.   ;Quote:Original post by Dragon_LanceWhat am i doing wrong?1) Being inconsistent about indentation. Consistent indentation makes it more obvious where the problem is, because you'll automatically count braces as you indent/dedent.2) Some programmers get in the habit of writing the close brace immediately when they write an open brace, and then filling in the middle. You may be able to get your IDE to do that for you automatically, too.   