ERROR--Unexpected end to file

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2006
Posts: 22
Reputation: chubbywubba is an unknown quantity at this point 
Solved Threads: 0
chubbywubba's Avatar
chubbywubba chubbywubba is offline Offline
Newbie Poster

ERROR--Unexpected end to file

 
0
  #1
Mar 6th, 2007
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.


  1. void main () {
  2. HANDLE hOut;
  3. COORD NewSBSize;
  4. SMALL_RECT DisplayArea = {0, 0, 0, 0};
  5. hOut = GetStdHandle(STD_OUTPUT_HANDLE);
  6. NewSBSize = GetLargestConsoleWindowSize(hOut);
  7. SetConsoleScreenBufferSize(hOut,
  8. NewSBSize);
  9. DisplayArea.Right = NewSBSize.X - 1;
  10. DisplayArea.Bottom = NewSBSize.Y - 1;
  11. SetConsoleWindowInfo(hOut,
  12. TRUE,
  13. &DisplayArea);
  14.  
  15. HANDLE hConsole;
  16. int k;
  17.  
  18. hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
  19.  
  20. for(k = 1; k < 2; k++) {
  21. SetConsoleTextAttribute(hConsole, 26);
  22. char keyPressed;
  23. bool quit = false;
  24.  
  25. int dX;
  26. int dY;
  27. int dZ;
  28.  
  29. do {
  30. system("cls");
  31. cout <<endl;
  32. cout <<endl;
  33. for (int a = 0; a < 90; a++) cout << box;
  34. cout << endl;
  35. cout <<box <<" " << box << endl;
  36. cout <<box <<" " << box << endl;
  37. cout <<box <<" xxx__xxx_xx_xx____xx_xxxxx__xxxx__xx_______xx_xxxxx_xxxxx_xxxxx___xxxxx_xxxxxx_ " << box <<endl;
  38. cout <<box <<" xxx__xxx_xx_xxx___xx_xxxxx_xxxxxx_xx_______xx_xxxxx_xxxxx_xxxxxx__xxxxx_xxxxxxx "<< box <<endl;
  39. cout <<box <<" xxx__xxx_xx_xxx___xx_xx____xxx_xx_xx_______xx_xx____xx____xx___xx_xx____xx___xx "<< box <<endl;
  40. cout <<box <<" xx_xx_xx_xx_xxxx__xx_xx____xx______xx_____xx__xx____xx____xx___xx_xx____xx___xx "<< box <<endl;
  41. cout <<box <<" xx_xx_xx_xx_xx_xx_xx_xxxxx__xx_____xx__x__xx__xxxxx_xxxxx_xxxxxx__xxxxx_xxxxxx_ "<< box <<endl;
  42. cout <<box <<" xx____xx_xx_xx__xxxx_xxxxx___xx____xx__x__xx__xxxxx_xxxxx_xxx_____xxxxx_xxxx___ "<< box <<endl;
  43. cout <<box <<" xx____xx_xx_xx__xxxx_xx_______xx___xx_xxx_xx__xx____xx____xx______xx____xx_xx__ "<< box <<endl;
  44. cout <<box <<" xx____xx_xx_xx___xxx_xx____xx_xxx___xxx_xxx___xx____xx____xx______xx____xx__xx_ "<< box <<endl;
  45. cout <<box <<" xx____xx_xx_xx____xx_xxxxx_xxxxxx___xx___xx___xxxxx_xxxxx_xx______xxxxx_xx__xx_ "<< box <<endl;
  46. cout <<box <<" xx____xx_xx_xx____xx_xxxxx__xxxx____xx___xx___xxxxx_xxxxx_xx______xxxxx_xx__xx_ "<< box <<endl;
  47. cout <<box <<" " << box << endl;
  48. cout <<box <<" " << box << endl;
  49. for (int b = 0; b < 90; b++) cout << box;
  50. cout << endl;
  51. cout << endl;
  52. cout << endl;
  53.  
  54. system("pause");
  55.  
  56. for (int d = 0; d < 90; d++) cout << box;
  57. cout << endl;
  58. cout <<box <<" " << box << endl;
  59. cout <<box <<" " << box << endl;
  60. cout <<box <<"Use ESC button to quit MINESWEEPER anytime" << box << endl;
  61. cout <<box <<"The arrow buttons on keyboard will move your player" << box << endl;
  62. cout <<box <<"Buttons < and > will be used to go up & down levels" << box << endl;
  63. cout <<box <<"Buttons = or - will increse/decrease the size" << box << endl;
  64. cout <<box <<" " << box << endl;
  65. cout <<box <<" " << box << endl;
  66. for (int e = 0; e < 90; e++) cout << box;
  67. cout << endl;
  68.  
  69.  
  70. system("pause");
  71.  
  72. for (int f = 0; f < 90; f++) cout << box;
  73. cout << endl;
  74. cout <<box <<" " << box << endl;
  75. cout <<box <<"Enter the number of rows you would like to have" << box <<endl;
  76. cout <<box <<" " << box << endl;
  77. for (int g = 0; g < 90; g++) cout << box;
  78. cout << endl;
  79. cout << endl;
  80. cout << endl;
  81.  
  82. cin >> dX;
  83.  
  84. while (dX > maxROW) {
  85. cout << "Please re-enter the number of rows that is less than that" << endl;
  86. cin >> dX;
  87. }
  88. while (dX < minROW) {
  89. cout << " Please re-enter the number of rows that is greater than that" << endl;
  90.  
  91. cin >> dX;
  92. }
  93. for (int h = 0; h < 90; h++) cout << box;
  94. cout << endl;
  95. cout <<box <<" " << box << endl;
  96. cout <<box <<"Enter the number of columns you would like to have" << box << endl;
  97. cout <<box <<" " << box << endl;
  98. for (int i = 0; i < 90; i++) cout << box;
  99. cout << endl;
  100. cout << endl;
  101. cout << endl;
  102.  
  103.  
  104. cin >> dY;
  105.  
  106. while (dY > maxCOL) {
  107. cout << "Please re-enter the number of columns that is less than that" << endl;
  108.  
  109. cin >> dY;
  110. }
  111. while (dY < minCOL) {
  112. cout << "Please re-enter the number of columns that is greater than that" << endl;
  113.  
  114. cin >> dY;
  115. }
  116. for (int j = 0; j < 90; j++) cout << box;
  117. cout << endl;
  118. cout<<endl;
  119. cout <<box <<"Enter the depth you would like to have" << box << endl;
  120. cout <<box <<" " << box << endl;
  121. for (int k = 0; k < 90; k++) cout << box;
  122. cout << endl;
  123. cout << endl;
  124. cout << endl;
  125.  
  126. cin >> dZ;
  127. while (dZ > maxDEPTH) {
  128. cout << "Please re-enter the depth you would like that is less than that" << endl;
  129. cin >> dZ;
  130. }
  131. while (dZ < minDEPTH) {
  132. cout << "Please re-enter the depth you would like that is greater than that" << endl;
  133. cin >> dZ;
  134. }
  135.  
  136. GridActive myGridActive (dX, dY, dZ);
  137.  
  138. do{
  139. myGridActive.setActive(myGridActive.getX(), myGridActive.getY(), myGridActive.getZ());
  140. myGridActive.print ( myGridActive.getZ() );
  141. myGridActive.printDimensions(myGridActive.getRow(), myGridActive.getCol(), myGridActive.getDepth());
  142. char key;
  143. bool flag = false;
  144.  
  145. key = getch();
  146. switch (toascii(key)) {
  147. case 'Q':
  148. case 'q':
  149. quit = true;
  150. break;
  151. case 80:
  152. if (flag) {
  153. myGridActive.goSouth();
  154. flag = false;
  155. }
  156. else
  157. cout << "try again. " << endl;
  158. break;
  159. case 72:
  160. if (flag) {
  161. myGridActive.goNorth();
  162. flag = false;
  163. }
  164. else
  165. cout << "try again. " << endl;
  166. break;
  167. case 77:
  168. if (flag) {
  169. myGridActive.goWest();
  170. flag = false;
  171. }
  172. else
  173. cout << "try again. " << endl;
  174. break;
  175. case 75:
  176. if (flag) {
  177. myGridActive.goEast();
  178. flag = false;
  179. }
  180. else
  181. cout << "try again. " << endl;
  182. break;
  183. case 73:
  184. if (flag) {
  185. myGridActive.upsize();
  186. flag = false;
  187. }
  188. else
  189. cout << "try again. " << endl;
  190. break;
  191. case 81:
  192. if (flag) {
  193. myGridActive.downsize();
  194. flag = false;
  195. }
  196. else
  197. cout << "try again. " << endl;
  198. break;
  199. }
  200. while (!quit);
  201. cout << "\n Would u like to start over? Press key \n Would u like to quit? Press N ";
  202. keyPressed = getch ();
  203. quit = false;
  204. if (( keyPressed == 'N' ) || (keyPressed == 'n' ))
  205. quit = true;
  206.  
  207. cin.get();
  208. printEnd();
  209. }
  210. }
Last edited by chubbywubba; Mar 6th, 2007 at 1:46 pm. Reason: forgot a question
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: ERROR--Unexpected end to file

 
0
  #2
Mar 6th, 2007
> 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.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,358
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1464
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: ERROR--Unexpected end to file

 
0
  #3
Mar 6th, 2007
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.
Last edited by Ancient Dragon; Mar 6th, 2007 at 2:33 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 22
Reputation: chubbywubba is an unknown quantity at this point 
Solved Threads: 0
chubbywubba's Avatar
chubbywubba chubbywubba is offline Offline
Newbie Poster

Re: ERROR--Unexpected end to file

 
0
  #4
Mar 6th, 2007
I fixed that now but I still have the un-expected file ending. Do you know why its doing this?
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 2,834
Reputation: niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute 
Solved Threads: 297
Moderator
Featured Poster
niek_e's Avatar
niek_e niek_e is offline Offline
Roasting Maven

Re: ERROR--Unexpected end to file

 
0
  #5
Mar 6th, 2007
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..

regards Niek
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 22
Reputation: chubbywubba is an unknown quantity at this point 
Solved Threads: 0
chubbywubba's Avatar
chubbywubba chubbywubba is offline Offline
Newbie Poster

Re: ERROR--Unexpected end to file

 
0
  #6
Mar 6th, 2007
  1. void main () {
  2. HANDLE hOut;
  3. COORD NewSBSize;
  4. SMALL_RECT DisplayArea = {0, 0, 0, 0};
  5. hOut = GetStdHandle(STD_OUTPUT_HANDLE);
  6. NewSBSize = GetLargestConsoleWindowSize(hOut);
  7. SetConsoleScreenBufferSize(hOut,
  8. NewSBSize);
  9. DisplayArea.Right = NewSBSize.X - 1;
  10. DisplayArea.Bottom = NewSBSize.Y - 1;
  11. SetConsoleWindowInfo(hOut,
  12. TRUE,
  13. &DisplayArea);
  14.  
  15. HANDLE hConsole;
  16. int k;
  17.  
  18. hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
  19.  
  20. for(k = 1; k < 2; k++) {
  21. SetConsoleTextAttribute(hConsole, 26);
  22. char keyPressed;
  23. bool quit = false;
  24.  
  25. int dX;
  26. int dY;
  27. int dZ;
  28.  
  29. do {
  30. system("cls");
  31. cout <<endl;
  32. cout <<endl;
  33. for (int a = 0; a < 90; a++) cout << box;
  34. cout << endl;
  35. cout <<box <<" " << box << endl;
  36. cout <<box <<" " << box << endl;
  37. cout <<box <<" xxx__xxx_xx_xx____xx_xxxxx__xxxx__xx_______xx_xxxxx_xxxxx_xxxxx___xxxxx_xxxxxx_ " << box <<endl;
  38. cout <<box <<" xxx__xxx_xx_xxx___xx_xxxxx_xxxxxx_xx_______xx_xxxxx_xxxxx_xxxxxx__xxxxx_xxxxxxx "<< box <<endl;
  39. cout <<box <<" xxx__xxx_xx_xxx___xx_xx____xxx_xx_xx_______xx_xx____xx____xx___xx_xx____xx___xx "<< box <<endl;
  40. cout <<box <<" xx_xx_xx_xx_xxxx__xx_xx____xx______xx_____xx__xx____xx____xx___xx_xx____xx___xx "<< box <<endl;
  41. cout <<box <<" xx_xx_xx_xx_xx_xx_xx_xxxxx__xx_____xx__x__xx__xxxxx_xxxxx_xxxxxx__xxxxx_xxxxxx_ "<< box <<endl;
  42. cout <<box <<" xx____xx_xx_xx__xxxx_xxxxx___xx____xx__x__xx__xxxxx_xxxxx_xxx_____xxxxx_xxxx___ "<< box <<endl;
  43. cout <<box <<" xx____xx_xx_xx__xxxx_xx_______xx___xx_xxx_xx__xx____xx____xx______xx____xx_xx__ "<< box <<endl;
  44. cout <<box <<" xx____xx_xx_xx___xxx_xx____xx_xxx___xxx_xxx___xx____xx____xx______xx____xx__xx_ "<< box <<endl;
  45. cout <<box <<" xx____xx_xx_xx____xx_xxxxx_xxxxxx___xx___xx___xxxxx_xxxxx_xx______xxxxx_xx__xx_ "<< box <<endl;
  46. cout <<box <<" xx____xx_xx_xx____xx_xxxxx__xxxx____xx___xx___xxxxx_xxxxx_xx______xxxxx_xx__xx_ "<< box <<endl;
  47. cout <<box <<" " << box << endl;
  48. cout <<box <<" " << box << endl;
  49. for (int b = 0; b < 90; b++) cout << box;
  50. cout << endl;
  51. cout << endl;
  52. cout << endl;
  53.  
  54. system("pause");
  55.  
  56. for (int d = 0; d < 90; d++) cout << box;
  57. cout << endl;
  58. cout <<box <<" " << box << endl;
  59. cout <<box <<" " << box << endl;
  60. cout <<box <<"Use ESC button to quit MINESWEEPER anytime" << box << endl;
  61. cout <<box <<"The arrow buttons on keyboard will move your player" << box << endl;
  62. cout <<box <<"Buttons < and > will be used to go up & down levels" << box << endl;
  63. cout <<box <<"Buttons = or - will increse/decrease the size" << box << endl;
  64. cout <<box <<" " << box << endl;
  65. cout <<box <<" " << box << endl;
  66. for (int e = 0; e < 90; e++) cout << box;
  67. cout << endl;
  68.  
  69.  
  70. system("pause");
  71.  
  72. for (int f = 0; f < 90; f++) cout << box;
  73. cout << endl;
  74. cout <<box <<" " << box << endl;
  75. cout <<box <<"Enter the number of rows you would like to have" << box <<endl;
  76. cout <<box <<" " << box << endl;
  77. for (int g = 0; g < 90; g++) cout << box;
  78. cout << endl;
  79. cout << endl;
  80. cout << endl;
  81.  
  82. cin >> dX;
  83.  
  84. while (dX > maxROW) {
  85. cout << "Please re-enter the number of rows that is less than that" << endl;
  86. cin >> dX;
  87. }
  88. while (dX < minROW) {
  89. cout << " Please re-enter the number of rows that is greater than that" << endl;
  90.  
  91. cin >> dX;
  92. }
  93. for (int h = 0; h < 90; h++) cout << box;
  94. cout << endl;
  95. cout <<box <<" " << box << endl;
  96. cout <<box <<"Enter the number of columns you would like to have" << box << endl;
  97. cout <<box <<" " << box << endl;
  98. for (int i = 0; i < 90; i++) cout << box;
  99. cout << endl;
  100. cout << endl;
  101. cout << endl;
  102.  
  103.  
  104. cin >> dY;
  105.  
  106. while (dY > maxCOL) {
  107. cout << "Please re-enter the number of columns that is less than that" << endl;
  108.  
  109. cin >> dY;
  110. }
  111. while (dY < minCOL) {
  112. cout << "Please re-enter the number of columns that is greater than that" << endl;
  113.  
  114. cin >> dY;
  115. }
  116. for (int j = 0; j < 90; j++) cout << box;
  117. cout << endl;
  118. cout<<endl;
  119. cout <<box <<"Enter the depth you would like to have" << box << endl;
  120. cout <<box <<" " << box << endl;
  121. for (int k = 0; k < 90; k++) cout << box;
  122. cout << endl;
  123. cout << endl;
  124. cout << endl;
  125.  
  126. cin >> dZ;
  127. while (dZ > maxDEPTH) {
  128. cout << "Please re-enter the depth you would like that is less than that" << endl;
  129. cin >> dZ;
  130. }
  131. while (dZ < minDEPTH) {
  132. cout << "Please re-enter the depth you would like that is greater than that" << endl;
  133. cin >> dZ;
  134. }
  135.  
  136. GridActive myGridActive (dX, dY, dZ);
  137.  
  138. do{
  139. myGridActive.setActive(myGridActive.getX(), myGridActive.getY(), myGridActive.getZ());
  140. myGridActive.print ( myGridActive.getZ() );
  141. myGridActive.printDimensions(myGridActive.getRow(), myGridActive.getCol(), myGridActive.getDepth());
  142. char key;
  143. bool flag = false;
  144.  
  145. key = getch();
  146. switch (toascii(key)) {
  147. case 'q':
  148. quit = true;
  149. break;
  150. case 80:
  151. if (flag) {
  152. myGridActive.goSouth();
  153. flag = false;
  154. }
  155. else
  156. cout << "try again. " << endl;
  157. break;
  158. case 72:
  159. if (flag) {
  160. myGridActive.goNorth();
  161. flag = false;
  162. }
  163. else
  164. cout << "try again. " << endl;
  165. break;
  166. case 77:
  167. if (flag) {
  168. myGridActive.goWest();
  169. flag = false;
  170. }
  171. else
  172. cout << "try again. " << endl;
  173. break;
  174. case 75:
  175. if (flag) {
  176. myGridActive.goEast();
  177. flag = false;
  178. }
  179. else
  180. cout << "try again. " << endl;
  181. break;
  182. case 73:
  183. if (flag) {
  184. myGridActive.upsize();
  185. flag = false;
  186. }
  187. else
  188. cout << "try again. " << endl;
  189. break;
  190. case 81:
  191. if (flag) {
  192. myGridActive.downsize();
  193. flag = false;
  194. }
  195. else
  196. cout << "try again. " << endl;
  197. break;
  198. }
  199. while (!quit);
  200. cout << "\n Would u like to start over? Press key \n Would u like to quit? Press N ";
  201. keyPressed = getch ();
  202. quit = false;
  203. if (( keyPressed == 'N' ) || (keyPressed == 'n' ))
  204. quit = true;
  205.  
  206. cin.get();
  207. printEnd();
  208. }
  209. }
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?
Last edited by chubbywubba; Mar 6th, 2007 at 3:03 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,358
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1464
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: ERROR--Unexpected end to file

 
0
  #7
Mar 6th, 2007
Originally Posted by chubbywubba View Post
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.
Last edited by Ancient Dragon; Mar 6th, 2007 at 6:21 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: ERROR--Unexpected end to file

 
0
  #8
Mar 6th, 2007
> 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.

  1. for ( i = 0 ; i < 10 ; i++ ) {
  2. }
Press "Compile", and all is well

  1. for ( i = 0 ; i < 10 ; i++ ) {
  2. cout << "hello" << var << endl;
  3. }
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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 539
Reputation: thekashyap will become famous soon enough thekashyap will become famous soon enough 
Solved Threads: 50
thekashyap's Avatar
thekashyap thekashyap is offline Offline
Posting Pro

Re: ERROR--Unexpected end to file

 
0
  #9
Mar 7th, 2007
You really gotta learn and use "functions"..
For the problem at hand try AStyle if it helps..
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC