My main has an unexpected end to the file and i am having problems finding the error. can anyone help? It also says where "case 81" is that i already used it but I have not.

void main () {
     HANDLE hOut;
     COORD NewSBSize;
     SMALL_RECT DisplayArea = {0, 0, 0, 0};
     hOut = GetStdHandle(STD_OUTPUT_HANDLE);
     NewSBSize = GetLargestConsoleWindowSize(hOut);
     SetConsoleScreenBufferSize(hOut,
                               NewSBSize);
     DisplayArea.Right = NewSBSize.X - 1;
     DisplayArea.Bottom = NewSBSize.Y - 1;
     SetConsoleWindowInfo(hOut,
                         TRUE,
                         &DisplayArea);
 
     HANDLE  hConsole;
     int k;
 
     hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
 
     for(k = 1; k < 2; k++) {
          SetConsoleTextAttribute(hConsole, 26);
          char keyPressed;
          bool quit = false;
 
          int dX;
          int dY;
          int dZ;
 
          do {
               system("cls");
               cout <<endl;
               cout <<endl;
               for (int a = 0; a < 90; a++) cout << box; 
               cout << endl;
               cout <<box <<"                                                                                        " << box << endl;
               cout <<box <<"                                                                                        " << box << endl;
               cout <<box <<"     xxx__xxx_xx_xx____xx_xxxxx__xxxx__xx_______xx_xxxxx_xxxxx_xxxxx___xxxxx_xxxxxx_    " << box <<endl;
               cout <<box <<"     xxx__xxx_xx_xxx___xx_xxxxx_xxxxxx_xx_______xx_xxxxx_xxxxx_xxxxxx__xxxxx_xxxxxxx    "<< box <<endl;
               cout <<box <<"     xxx__xxx_xx_xxx___xx_xx____xxx_xx_xx_______xx_xx____xx____xx___xx_xx____xx___xx    "<< box <<endl;
               cout <<box <<"     xx_xx_xx_xx_xxxx__xx_xx____xx______xx_____xx__xx____xx____xx___xx_xx____xx___xx    "<< box <<endl;
               cout <<box <<"     xx_xx_xx_xx_xx_xx_xx_xxxxx__xx_____xx__x__xx__xxxxx_xxxxx_xxxxxx__xxxxx_xxxxxx_    "<< box <<endl;
               cout <<box <<"     xx____xx_xx_xx__xxxx_xxxxx___xx____xx__x__xx__xxxxx_xxxxx_xxx_____xxxxx_xxxx___    "<< box <<endl;
               cout <<box <<"     xx____xx_xx_xx__xxxx_xx_______xx___xx_xxx_xx__xx____xx____xx______xx____xx_xx__    "<< box <<endl;
               cout <<box <<"     xx____xx_xx_xx___xxx_xx____xx_xxx___xxx_xxx___xx____xx____xx______xx____xx__xx_    "<< box <<endl;
               cout <<box <<"     xx____xx_xx_xx____xx_xxxxx_xxxxxx___xx___xx___xxxxx_xxxxx_xx______xxxxx_xx__xx_    "<< box <<endl;
               cout <<box <<"     xx____xx_xx_xx____xx_xxxxx__xxxx____xx___xx___xxxxx_xxxxx_xx______xxxxx_xx__xx_    "<< box <<endl;
               cout <<box <<"                                                                                        " << box << endl;
               cout <<box <<"                                                                                        " << box << endl;
               for (int b = 0; b < 90; b++) cout << box; 
               cout << endl;
               cout << endl;
               cout << endl;
 
               system("pause");
 
               for (int d = 0; d < 90; d++) cout << box; 
               cout << endl;
               cout <<box <<"                                                                          " << box << endl;
               cout <<box <<"                                                                          " << box << endl;
               cout <<box <<"Use ESC button to quit MINESWEEPER anytime" << box << endl;
               cout <<box <<"The arrow buttons on keyboard will move your player" << box << endl;
               cout <<box <<"Buttons < and > will be used to go up & down levels" << box << endl;
               cout <<box <<"Buttons = or - will increse/decrease the size" << box << endl;
               cout <<box <<"                                                                      " << box << endl;
               cout <<box <<"                                                                      " << box << endl;
               for (int e = 0; e < 90; e++) cout << box; 
               cout << endl;
 
 
               system("pause");
 
               for (int f = 0; f < 90; f++) cout << box; 
               cout << endl;
               cout <<box <<"                                                                     " << box << endl;
               cout <<box <<"Enter the number of rows you would like to have" << box <<endl;
               cout <<box <<"                                                                      " << box << endl;
               for (int g = 0; g < 90; g++) cout << box; 
               cout << endl;
               cout << endl;
               cout << endl;
 
               cin >> dX;
 
               while (dX > maxROW) {
                    cout << "Please re-enter the number of rows that is less than that" << endl;
                    cin >> dX;
               }
               while (dX < minROW) {
                    cout << " Please re-enter the number of rows that is greater than that" << endl;
 
                    cin >> dX;
               }
               for (int h = 0; h < 90; h++) cout << box; 
               cout << endl;
               cout <<box <<"                                                                          " << box << endl;
               cout <<box <<"Enter the number of columns you would like to have" << box << endl;
               cout <<box <<"                                                                          " << box << endl;
               for (int i = 0; i < 90; i++) cout << box; 
               cout << endl;
               cout << endl;
               cout << endl;
 
 
               cin >> dY;
 
               while (dY > maxCOL) {
                    cout << "Please re-enter the number of columns that is less than that" << endl;
 
                    cin >> dY;
                }
                while (dY < minCOL) {
                     cout << "Please re-enter the number of columns that is greater than that" << endl;
 
                     cin >> dY;
                }
                for (int j = 0; j < 90; j++) cout << box; 
               cout << endl; 
               cout<<endl;
               cout <<box <<"Enter the depth you would like to have" << box << endl;
               cout <<box <<"                                                       " << box << endl;
               for (int k = 0; k < 90; k++) cout << box; 
               cout << endl;
               cout << endl;
               cout << endl;
 
               cin >> dZ;
               while (dZ > maxDEPTH) {
                    cout << "Please re-enter the depth you would like that is less than that" << endl;
                    cin >> dZ;
               }
               while (dZ < minDEPTH) {
                    cout << "Please re-enter the depth you would like that is greater than that" << endl;
                    cin >> dZ;
               }
 
               GridActive myGridActive (dX, dY, dZ);
 
              do{
                   myGridActive.setActive(myGridActive.getX(), myGridActive.getY(), myGridActive.getZ());
                   myGridActive.print ( myGridActive.getZ() );
                   myGridActive.printDimensions(myGridActive.getRow(), myGridActive.getCol(), myGridActive.getDepth());
                   char key;
                   bool flag = false;
 
                   key = getch();
                   switch (toascii(key)) {
                        case 'Q':
                        case 'q':
                             quit = true;
                             break; 
                        case 80:
                                  if (flag) {
                                       myGridActive.goSouth();
                                       flag = false;
                                  }
                             else 
                                  cout << "try again. " << endl; 
                             break;
                        case 72:
                                  if (flag) {
                                       myGridActive.goNorth();
                                       flag = false;
                                  }
                              else 
                                  cout << "try again. " << endl; 
                              break;
                         case 77:
                                  if (flag) { 
                                       myGridActive.goWest();
                                       flag = false;
                                  }
                              else 
                                  cout << "try again. " << endl; 
                              break;
                         case 75:
                              if (flag) {
                                   myGridActive.goEast();
                                   flag = false;
                              }
                              else 
                                   cout << "try again. " << endl; 
                              break;
                         case 73:
                              if (flag) {
                                   myGridActive.upsize();
                                   flag = false;
                              }
                              else
                                   cout << "try again. " << endl;
                              break;
                         case 81:
                              if (flag) {
                                   myGridActive.downsize();
                                   flag = false;
                              }
                              else
                                   cout << "try again. " << endl;
                              break;
                         }
                        while (!quit);
                        cout << "\n Would u like to start over? Press key \n  Would u like to quit? Press N ";
                        keyPressed = getch ();
                        quit = false;
                        if (( keyPressed == 'N' ) || (keyPressed == 'n' ))
                        quit = true;
 
                        cin.get();
                        printEnd();
       }
}

> says where "case 81" is that i already used it but I have not.
'Q' is 81 in ASCII, so yes, you used it twice.

So if all your other magic numbers are really letters, then use letters.

you have mis-matched curly braces. The open brace on the do-loop is matched to the last close brace in the function. This is one reason I always place curly braces on lines by themselves so that they are easy to spot and match up. Some compilers IDEs and code editors, such as Microsoft VC++ and VI have macros that will show you the matching brace. Check you compiler's IDE to see if it has such a feature.

I fixed that now but I still have the un-expected file ending. Do you know why its doing this?

Please post your new code.
I still think you have a 'curlybracketsmismatch'.
In Visual Studio the macro is CTRL-A, CTRL-K, CTRL-F in that order.

One more thing that someone probably allready told you, but: void main() and system("somethiong") are bad coding habits..

void main () {
     HANDLE hOut;
     COORD NewSBSize;
     SMALL_RECT DisplayArea = {0, 0, 0, 0};
     hOut = GetStdHandle(STD_OUTPUT_HANDLE);
     NewSBSize = GetLargestConsoleWindowSize(hOut);
     SetConsoleScreenBufferSize(hOut,
                               NewSBSize);
     DisplayArea.Right = NewSBSize.X - 1;
     DisplayArea.Bottom = NewSBSize.Y - 1;
     SetConsoleWindowInfo(hOut,
                         TRUE,
                         &DisplayArea);
 
     HANDLE  hConsole;
     int k;
 
     hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
 
     for(k = 1; k < 2; k++) {
          SetConsoleTextAttribute(hConsole, 26);
          char keyPressed;
          bool quit = false;
 
          int dX;
          int dY;
          int dZ;
 
          do {
               system("cls");
               cout <<endl;
               cout <<endl;
               for (int a = 0; a < 90; a++) cout << box; 
               cout << endl;
               cout <<box <<"                                                                                        " << box << endl;
               cout <<box <<"                                                                                        " << box << endl;
               cout <<box <<"     xxx__xxx_xx_xx____xx_xxxxx__xxxx__xx_______xx_xxxxx_xxxxx_xxxxx___xxxxx_xxxxxx_    " << box <<endl;
               cout <<box <<"     xxx__xxx_xx_xxx___xx_xxxxx_xxxxxx_xx_______xx_xxxxx_xxxxx_xxxxxx__xxxxx_xxxxxxx    "<< box <<endl;
               cout <<box <<"     xxx__xxx_xx_xxx___xx_xx____xxx_xx_xx_______xx_xx____xx____xx___xx_xx____xx___xx    "<< box <<endl;
               cout <<box <<"     xx_xx_xx_xx_xxxx__xx_xx____xx______xx_____xx__xx____xx____xx___xx_xx____xx___xx    "<< box <<endl;
               cout <<box <<"     xx_xx_xx_xx_xx_xx_xx_xxxxx__xx_____xx__x__xx__xxxxx_xxxxx_xxxxxx__xxxxx_xxxxxx_    "<< box <<endl;
               cout <<box <<"     xx____xx_xx_xx__xxxx_xxxxx___xx____xx__x__xx__xxxxx_xxxxx_xxx_____xxxxx_xxxx___    "<< box <<endl;
               cout <<box <<"     xx____xx_xx_xx__xxxx_xx_______xx___xx_xxx_xx__xx____xx____xx______xx____xx_xx__    "<< box <<endl;
               cout <<box <<"     xx____xx_xx_xx___xxx_xx____xx_xxx___xxx_xxx___xx____xx____xx______xx____xx__xx_    "<< box <<endl;
               cout <<box <<"     xx____xx_xx_xx____xx_xxxxx_xxxxxx___xx___xx___xxxxx_xxxxx_xx______xxxxx_xx__xx_    "<< box <<endl;
               cout <<box <<"     xx____xx_xx_xx____xx_xxxxx__xxxx____xx___xx___xxxxx_xxxxx_xx______xxxxx_xx__xx_    "<< box <<endl;
               cout <<box <<"                                                                                        " << box << endl;
               cout <<box <<"                                                                                        " << box << endl;
               for (int b = 0; b < 90; b++) cout << box; 
               cout << endl;
               cout << endl;
               cout << endl;
 
               system("pause");
 
               for (int d = 0; d < 90; d++) cout << box; 
               cout << endl;
               cout <<box <<"                                                                          " << box << endl;
               cout <<box <<"                                                                          " << box << endl;
               cout <<box <<"Use ESC button to quit MINESWEEPER anytime" << box << endl;
               cout <<box <<"The arrow buttons on keyboard will move your player" << box << endl;
               cout <<box <<"Buttons < and > will be used to go up & down levels" << box << endl;
               cout <<box <<"Buttons = or - will increse/decrease the size" << box << endl;
               cout <<box <<"                                                                      " << box << endl;
               cout <<box <<"                                                                      " << box << endl;
               for (int e = 0; e < 90; e++) cout << box; 
               cout << endl;
 
 
               system("pause");
 
               for (int f = 0; f < 90; f++) cout << box; 
               cout << endl;
               cout <<box <<"                                                                     " << box << endl;
               cout <<box <<"Enter the number of rows you would like to have" << box <<endl;
               cout <<box <<"                                                                      " << box << endl;
               for (int g = 0; g < 90; g++) cout << box; 
               cout << endl;
               cout << endl;
               cout << endl;
 
               cin >> dX;
 
               while (dX > maxROW) {
                    cout << "Please re-enter the number of rows that is less than that" << endl;
                    cin >> dX;
               }
               while (dX < minROW) {
                    cout << " Please re-enter the number of rows that is greater than that" << endl;
 
                    cin >> dX;
               }
               for (int h = 0; h < 90; h++) cout << box; 
               cout << endl;
               cout <<box <<"                                                                          " << box << endl;
               cout <<box <<"Enter the number of columns you would like to have" << box << endl;
               cout <<box <<"                                                                          " << box << endl;
               for (int i = 0; i < 90; i++) cout << box; 
               cout << endl;
               cout << endl;
               cout << endl;
 
 
               cin >> dY;
 
               while (dY > maxCOL) {
                    cout << "Please re-enter the number of columns that is less than that" << endl;
 
                    cin >> dY;
                }
                while (dY < minCOL) {
                     cout << "Please re-enter the number of columns that is greater than that" << endl;
 
                     cin >> dY;
                }
                for (int j = 0; j < 90; j++) cout << box; 
               cout << endl; 
               cout<<endl;
               cout <<box <<"Enter the depth you would like to have" << box << endl;
               cout <<box <<"                                                       " << box << endl;
               for (int k = 0; k < 90; k++) cout << box; 
               cout << endl;
               cout << endl;
               cout << endl;
 
               cin >> dZ;
               while (dZ > maxDEPTH) {
                    cout << "Please re-enter the depth you would like that is less than that" << endl;
                    cin >> dZ;
               }
               while (dZ < minDEPTH) {
                    cout << "Please re-enter the depth you would like that is greater than that" << endl;
                    cin >> dZ;
               }
 
               GridActive myGridActive (dX, dY, dZ);
 
              do{
                   myGridActive.setActive(myGridActive.getX(), myGridActive.getY(), myGridActive.getZ());
                   myGridActive.print ( myGridActive.getZ() );
                   myGridActive.printDimensions(myGridActive.getRow(), myGridActive.getCol(), myGridActive.getDepth());
                   char key;
                   bool flag = false;
 
                   key = getch();
                   switch (toascii(key)) {
                        case 'q':
                             quit = true;
                             break; 
                        case 80:
                                  if (flag) {
                                       myGridActive.goSouth();
                                       flag = false;
                                  }
                             else 
                                  cout << "try again. " << endl; 
                             break;
                        case 72:
                                  if (flag) {
                                       myGridActive.goNorth();
                                       flag = false;
                                  }
                              else 
                                  cout << "try again. " << endl; 
                              break;
                         case 77:
                                  if (flag) { 
                                       myGridActive.goWest();
                                       flag = false;
                                  }
                              else 
                                  cout << "try again. " << endl; 
                              break;
                         case 75:
                              if (flag) {
                                   myGridActive.goEast();
                                   flag = false;
                              }
                              else 
                                   cout << "try again. " << endl; 
                              break;
                         case 73:
                              if (flag) {
                                   myGridActive.upsize();
                                   flag = false;
                              }
                              else
                                   cout << "try again. " << endl;
                              break;
                         case 81:
                              if (flag) {
                                   myGridActive.downsize();
                                   flag = false;
                              }
                              else
                                   cout << "try again. " << endl;
                              break;
                         }
                        while (!quit);
                        cout << "\n Would u like to start over? Press key \n  Would u like to quit? Press N ";
                        keyPressed = getch ();
                        quit = false;
                        if (( keyPressed == 'N' ) || (keyPressed == 'n' ))
                        quit = true;
 
                        cin.get();
                        printEnd();
       }
}

I looked for a bracket but I cannot find one missing.

And they told me not use void main() but my teacher says we should. If the void main() and system("something") are bad coding how would i fix that or what else could i put?

I fixed that now but I still have the un-expected file ending. Do you know why its doing this?

No you didn't -- curly braces still mismatched in your latest code just like they were in the original. Fix the braces and it will probably correct end-of-file error.

>>And they told me not use void main() but my teacher says we should
you need a different teacher because he/she doesn't know what he/she is talking about. void main has never ever been standard C or C++ syntax.


>>I looked for a bracket but I cannot find one missing
The program is missing two braces. One is the second do-loop is missing a close brace. I'm not certain where the other one is.

Suggestion: split your main() function into more than one function to keep the code short and easy for you to maintain, assuming you are allowed to do that. Your main() is just too big and unwieldly, and will give even most experienced programmers large head aches.

> I looked for a bracket but I cannot find one missing.
Your main is over 200 lines long (and growing no doubt).
Moving some of the functionality into other functions will make things a lot clearer.

for ( i = 0 ; i < 10 ; i++ ) {
}

Press "Compile", and all is well

for ( i = 0 ; i < 10 ; i++ ) {
  cout << "hello" << var << endl;
}

Press "Compile", and get a warning.

Lessons
1. by always typing in the { } in matched pairs BEFORE doing anything else, you never get into this problem of figuring out where the } should go to match the { you typed in yesterday.
2. by compiling often (ctrl-f7 and wait a couple of seconds) means you don't dig huge holes which take a long time to fix. If you only typed 5 lines since your last compile, then you've got a good idea where to look.
3. actually running the code every so often to make sure it's doing what it should is a good idea as well.
4. the always type the matching pairs applies to ( ), " " and /**/ as well. Sure it's a few extra cursor movements, but it sure cuts down on the confusion later on.

As experience grows, you can get away with typing more lines between compiles, but don't go beyond what you're prepared to deal with.
200+ lines and dump the whole lot on a message board definitely isn't the way to go.

You really gotta learn and use "functions"..
For the problem at hand try AStyle if it helps..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.