Declaring multiple functions

This is a discussion on Declaring multiple functions within the C++ Programming forums, part of the General Programming Boards category; Hey everyone. I'm new to C++ and I have a project to do in a week. I need some help ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    1

    Declaring multiple functions

    Hey everyone. I'm new to C++ and I have a project to do in a week. I need some help by knowing how to start. The first thing I need to do is to create a menu. I have a rough idea, but I was wondering how do I make a selection according to the input?

    (Example: Press 1 to... Press 2 to...)

    Thanks for your help. Thanks a lot. I really appreciate it.

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    164
    I assume you are using 'cout'/'cin'.

    For example, write:

    void main(void)
    {
    long cmd;
    cout << "1. Start\n";
    cout << "2. Exit\n";
    cout << "What to do? ";
    cin >> cmd;
    switch(cmd)
    {
    case 1:
    StartApp();
    break;

    case 2:
    ExitApp();
    break;
    }
    }

    Then you need to have two functions named StartApp() and ExitApp().
    // Gliptic

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 06-08-2009, 03:03 PM
  2. Phantom redefinition
    By CodeMonkey in forum C++ Programming
    Replies: 6
    Last Post: 06-12-2005, 05:42 PM
  3. Linker errors - Multiple Source files
    By nkhambal in forum C Programming
    Replies: 3
    Last Post: 04-24-2005, 02:41 AM
  4. Recursion vs multiple functions
    By PJYelton in forum C++ Programming
    Replies: 4
    Last Post: 12-29-2002, 07:52 PM
  5. Declaring Functions
    By Thantos in forum C Programming
    Replies: 3
    Last Post: 09-25-2001, 10:24 PM

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