Running multiple programs

This is a discussion on Running multiple programs within the C++ Programming forums, part of the General Programming Boards category; My sample, stupid fake code: Code: #include <iostream.h> int x; int main(void) { cout << "Option 1, 2 or 3?" ...

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    31

    Running multiple programs

    My sample, stupid fake code:
    Code:
    #include <iostream.h>
    
    int x;
    
    int main(void)
    {
    cout << "Option 1, 2 or 3?"
    cin x;
    switch(x)
    case 1:
    {run this program}
    break;
    case 2:
    {run this other program}
    break;
    case 3:
    {quit}
    break;
    OK, can I get it to finish one case and then go back to the top of the program? My knowledge of this is...limited at best, so please don't laugh at me if, say, it already does what I'm trying to do.

  2. #2
    Registered User
    Join Date
    Mar 2003
    Location
    UK
    Posts
    169
    Add a loop...
    Code:
    int main(void)
    {
       int Quit=0;
       while( !Quit )
       {
            cout << "Option 1, 2 or 3?"
            cin x;
            switch(x)
            {
            case 1:
                 {run this program}
                  break;
            case 2:
                 {run this other program}
                  break;
            case 3:
                 Quit=1;
                 break;
            }
       }
        return 0;
    }

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    31
    I was hoping there was a faster way to do it, but thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using multiple .cpp files for programs
    By DevEight in forum C++ Programming
    Replies: 5
    Last Post: 10-21-2007, 07:56 AM
  2. why Multiple define error ...
    By nilathinesh in forum C Programming
    Replies: 2
    Last Post: 10-19-2006, 06:31 AM
  3. Detect Running Programs?
    By MattKamil in forum Windows Programming
    Replies: 2
    Last Post: 07-03-2006, 06:13 AM
  4. How come Dev C++ cant run some programs??
    By Sephiroth in forum C Programming
    Replies: 41
    Last Post: 09-17-2005, 05:35 AM

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