Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   C (https://www.askmehelpdesk.com/forumdisplay.php?f=438)
-   -   Ask c questions online (https://www.askmehelpdesk.com/showthread.php?t=741718)

  • Mar 29, 2013, 07:45 PM
    Jitender rana
    ask c questions online
    #include<stdio.h>
    #include<conio.h>
    struct complex {
    float real;
    float image;
    };
    void main()
    {
    struct complex a,b;
    input();
    }
    {
    input()}

    struct complex a,b;
    int c;
    printf("enter the first complex no (x+iy)\n");
    scanf("%f %f \n",&a.real,&b.image);
    printf("enter the 2nd complex no. (x+iy)\n");
    scanf("%f %f\n",&a.real,&b.image);
    while((c=getchar())!='q'){
    menu();
    switch(c){
    case 'a':
    add(a,b);
    break;
    case's':
    sub(a,b);
    break;
    case'm':
    mult(a,b);
    break;
    case'd':
    div(a,b);
    break;
    }
    }
    menu()
    {
    printf("a=addition\n");
    printf("enter an option\n");
    }
    add(a,b)
    struct complex a,b;
    {
    struct complex c;
    c.real=a.real+b.real;
    c.image=a.image+b.image;
    printf("addition of 2 complex no:\n");
    output(c);
    }

    output(c);
    struct complex c;
    {
    if(c.image<0)
    printf("%0.2f %0.2fi\n",c.real,c.image);
    else
    printf("%0.2f+i%0.2f\n",c.real,c.image);
    }
    getch();
    }



    not able to run the program.please help!

  • All times are GMT -7. The time now is 02:15 AM.