Hi, I'm a student learning to code in C. This is what I have only when I compile it, gcc, I get two error messages and I don't understnd why. The messages are '67: error: expected declaration or statement at end of input' and '67: error: control reaaches end of non-void funtion' This is the code as I have it now, line 67 is the last line in the program...the }. Any info would be helpful.

#include <stdio.h>
#include<stdlib.h>
#include<time.h>


int main(void){

	//declarations

   int menuChoice;
   int i,n=0;
   int r=rand()%100 + 1;;

 srand(time(NULL));

   //statements
   while (menuChoice !=3){
   //Choose mode
   printf("          *******************************************\n");
   printf("          ****** Would you like to play a game ******\n");
   printf("          *******************************************\n");

   printf("            1.    Guess the number that I'm thinking\n");
   printf("            2.    Global Thermonuclear War\n");
   printf("            3.             Exit\n\n\n");
   printf("                 Please Choose a Menu Item:   ");

   scanf("%d", &menuChoice);
   if (menuChoice > 3) {
       printf("                   You don't follow directions very well do you... try again\n");
   }
   if (menuChoice ==2){
      printf("You really need to watch 'War Games' and come back to see me.\n");
      }
   else if (menuChoice ==3){
        printf("               Have a good day\n\n\n\n\n");
   }
   else if (menuChoice == 1){
      printf("                   You chose option 1.\n");

      printf("I have my number\n\nWhat number am I thinking of between 1 and 100.");
   while(scanf("%d",&i))

   if (i > r)
{
      n++;
      printf("Your guess is high. Please try again: ");
}
   else if (i < r)
{
      n++;
      printf("Your guess is low. Please try again: ");
}
   else if (i == r)
{
      printf("\n\nCongratulations!\nYou guessed the number in %d guesses! \n", n+1);
      }

   }
 return 0;
}

You are missing the closing } for the main function. The last } shown in this post, belongs to the while loop.
Now, you would have better luck tracking down the {} if you learn to format your code.

I hate it when I miss that... thanks. I don't fully understand the correct way to format as I write it.. but I"m learning.

Thanks again.

I hate it when I miss that... thanks. I don't fully understand the correct way to format as I write it.. but I"m learning.

Thanks again.

Now you know what that error means for next time.
Something about indentation.

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.