1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Misplaced else in function ...

Discussion in 'C++' started by sashank.thags, Aug 28, 2010.

  1. sashank.thags

    sashank.thags New Member

    Joined:
    Aug 28, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi
    I have a problem with my c++ code which is compiled using turbo c++ on vista

    and the code is:

    outtextxy(99,40,"f");
    p=getch();
    if(p==27)
    main();
    else if(p=='f')

    void fig();

    error is: misplaced else in function

    i have tried changing to
    o uttextxy(99,40,"f");
    p=getch();
    if(p==27){
    main();}
    else if(p=='f') {

    void fig(); }
    and now the error says

    cannot call 'main' from within the program in function

    please help me out
     

Share This Page