Thread: Organiser

  1. #1
    Registered User
    Join Date
    Jan 2004
    Posts
    14

    Organiser

    I need to create a menu that contains the following entries. I am creating a 'text-based' menu driven Electronic Organiser.

    1) The Menu:

    Menu structure contains these entries:

    - Create an entry
    - Amend/Delete an entry
    - Search for an entry
    - Create mobile phone transfer file
    - Quit Application

    Thanks.... any suggestions on how to do this, would be appreciated greatly.....

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    What bit are you having trouble with? Post the code you've tried so far, and explain where you're having troubles and someone will help you.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Registered User
    Join Date
    Jan 2004
    Posts
    14
    That's the problem, I want to create a personal Electronic Organiser and I am a raw novice in C Programming. I have been learning Programming for around 3 weeks, I don't know which functions I need to use? Obviously printf and scanf functions, but I don't know how to write this code to do this.... I don't want full help, I just want ideas and maybe small parts of code to assist me....

    Thanks........

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    Code:
    /* Warning: This code is from memory and untested */
    #include <stdio.h>
    
    int menu ( void );
    void create_entry ( void ) { puts ( "create entry" ); }
    void update_entry ( void ) { puts ( "update/delete entry" ); }
    void search_entry ( void ) { puts ( "search entry" ); }
    void create_transfer ( void ) { puts ( "create transfer file" ); }
    
    int main ( void )
    {
      void (*jump_menu[4]) ( void ) = {
        create_entry,
        update_entry,
        search_entry,
        create_transfer,
      };
      int option;
    
      while ( ( option = menu() ) != 5 ) {
        if ( option < 1 || option >= 5 ) {
          printf ( "Blah, bad choice\n" );
        }
        else {
          jump_menu[option - 1]();
        }
      }
    
      return 0;
    }
    
    int menu ( void )
    {
      int option;
    
      printf ( "1) Create an entry\n"
               "2) Amend/Delete an entry\n"
               "3) Search for an entry\n"
               "4) Create mobile phone transfer file\n"
               "5) Quit Application\n"
               ":> ");
      scanf ( "%d", &option );
    
      return option;
    }
    Or you could search the boards. This question is asked at least once a week.
    My best code is written with the delete key.

  5. #5
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>I have been learning Programming for around 3 weeks
    Code:
     void (*jump_menu[4]) ( void ) = {
         create_entry,
         update_entry,
         search_entry,
         create_transfer,
       };
    Function pointer arrays, you meany?! Sorry, got to highlight that one But hopefully Socrates will get the jist of what's going on...
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  6. #6
    Registered User
    Join Date
    Jan 2004
    Posts
    14
    Thanks very much for helping me out.... Its appreciated....

  7. #7
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >But hopefully Socrates will get the jist of what's going on...
    The jist being to search the boards for more suitable code.
    My best code is written with the delete key.

  8. #8
    Registered User
    Join Date
    Jan 2004
    Posts
    14
    Yeah, I know that's a pointer array function. Its cool, heh.... hopefully I'll get all this in the next few months.... I just have to work out how to actually file process a create an entry now into this organiser.... haha.....

Popular pages Recent additions subscribe to a feed