LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   URGENT small help for a C noob (https://www.linuxquestions.org/questions/programming-9/urgent-small-help-for-a-c-noob-398428/)

safrout 01-01-2006 04:18 PM

URGENT small help for a C noob
 
i just need to know the command i need to do the following, i am making a c prg called main menu which when run give the user a menu of 4 choices to choose between other 4 prgs located in the same folder and to run the one the user will choose

i just need to know the command to run those prg and then exit the main menu prg

suppsong that the files r located under folder named OR on a floppy drive I.E a:\OR\...
and the files are named cpm.bas , pert.bas, srm.bas

Code:

#include <stdio.h>
#include <conio.h>
#include <stlib.h>
 int main()
{
    char choice;
    printf("**************************************************************\n");
    printf("*                                        sadat academy      *\n");
    printf("*                                    computer department    *\n");
    printf("*                                  ***********************  *\n");
    printf("*                                                            *\n");
    printf("*                                                            *\n");
    printf("*                  main menu                                *\n");
    printf("*          ****************************                    *\n");
    printf("*          *                          *                    *\n");
    printf("*          * (1) shortest route model *                    *\n");
    printf("*          * (2) critical path model  *                    *\n");
    printf("*          * (3) pert model          *                    *\n");
    printf("*          * (4) exit                *                    *\n");
    printf("*          *                          *                    *\n");
    printf("*          ****************************                    *\n");
    printf("*                                                            *\n");
    printf("*                                                            *\n");
    printf("*                                                            *\n");
    printf("*                                                            *\n");
    printf("**************************************************************\n");
    printf("enter your choice of the following\n");
    printf("1. shortest route model\n");
    printf("2. critical path model\n");
    printf("3. pert model\n");
    printf("4. exit\n");
    choice = getch();
    switch (choice)
    {
        case 1 :
            ??????????????????
        case 2 :
            ???????????????????
        case 3 :
            ???????????????????
        case 4 :
            ???????????????????
        defult :
            printf("error please enter 1,2,3,or4");
        }
        return 0;
        getch();
  }


exvor 01-01-2006 07:32 PM

To run a program on the computer inside so to speeak your program you use the system function call.


to run things locally in the same folder would be system dependent.



man system for more details.

dogpatch 01-01-2006 10:24 PM

Most threads have to do with Linux-related questions. Your question here seems to be for a DOS system; is that correct? That's ok, i'm just wondering if there really are other old DOS dinosaurs out there besides myself. And if this is so, you would want to use one of the exec function calls, for example:
Code:


case '1':
    execl("gwbasic","a:\or\srm.bas",NULL);
    break;

(If this is not a DOS question, please disregard this irrelevant post.)

Quote:

Do whatever he tells you.
- Mary of Nazareth

safrout 01-02-2006 07:54 AM

ya it is DOs related

thank very much

i asked here cause this was an ass. i have to do for the OR prof

thanks again very much


All times are GMT -5. The time now is 08:39 AM.