Can someone be my eyes for me?

This is a discussion on Can someone be my eyes for me? within the C Programming forums, part of the General Programming Boards category; So, I am here again with another question. I am doing more of my C programming book exercises and i'v ...

  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    62

    Can someone be my eyes for me?

    So, I am here again with another question. I am doing more of my C programming book exercises and i'v run into a snag. Right now I get the following error::

    expected `;' before "int"
    in function `int main()`:
    `menu' cannot be used as a function
    `menu' cannot be used as a function

    I figure it's probably something stupid I missed. But i'v gone over every line like 4 times, and I still can't find it. Here's what i'v got so far.

    Code:
    #include <stdio.h>
    #include <ctype.h>
    
    int menu(void);
    int song(void);
    int show(void);
     
    int main(void)
    {
       int choice;
       int menu;
       
     
       choice = menu();   /* get user's first selection */
       
     
       while(choice != QUIT)
       {
          switch(choice)
          {
             case '1': show();
                         break;
             case '2': song();
                         break;
             default:    printf("Oops! An invalid choice slipped through. ");
                         printf("Please try again.\n");
          }
          choice = menu(); /* get user's subsequent selections */
       }
     
       printf("Bye bye!\n");
     
    
       printf("Press Enter to end the program.\n");
       fflush(stdin);
       getchar();
     
       return 0;
    }
     
    int menu(void)
    {
       int option;
     
           
          printf("Learn more about me! Please select from the menu.\n");
     
          printf("1. Learn the name of my favorite show!\n2. Learn the first 4 lines of my favorite song!\n");
     
          printf("Type Quit, to quit the Program!\n");
     
          printf("Please enter the choice you wish to make:\n");
       
     
       while( (scanf(" %d", &option) != 1) /* non-numeric input */
              || (option < 0)               /* number too small */
              || (option > 2))              /* number too large */
       {
          fflush(stdin);                    /* clear bad data from buffer */
          printf("That selection isn't valid. Please try again.\n");
          printf("Your choice? ");
       }
       return option;
    }
     
    void song(void)
    {
         printf("Do you remember standing on a broken field\n");
         printf("White crippled wings beating the sky\n"):
         printf("The harbingers of war with their nature revealed\n");
         printf("And our chances flowing by\n");
    }
     
    void show(void)
    {
         printf("Big Bang Theory // Two And A Half Men\n");
    }
    Thanks for any help you can provide.

  2. #2
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    You have a function menu and a variable menu.

  3. #3
    Registered User
    Join Date
    Feb 2011
    Posts
    62
    Quote Originally Posted by Bayint Naung View Post
    You have a function menu and a variable menu.
    Told you I missed something simple
    Thanks alot

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,761
    > fflush(stdin);
    See the FAQ for why this is a bad thing.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Do your eyes bleed?
    By B0bDole in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-25-2004, 02:12 AM
  2. need another pair of eyes please
    By dustyd in forum C++ Programming
    Replies: 4
    Last Post: 01-23-2003, 03:12 PM
  3. need a second pair of eyes to debug
    By RyeDunn in forum C Programming
    Replies: 7
    Last Post: 08-02-2002, 11:02 AM
  4. HELP - Debugging EYES ARE SQUARE!
    By ACAC in forum Game Programming
    Replies: 4
    Last Post: 01-29-2002, 09:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21