Thread: Problem with if else on turbo c ++, if statement missing, ive compiled a bunch of ...

  1. #1
    Registered User
    Join Date
    May 2013
    Posts
    2

    Problem with if else on turbo c ++, if statement missing, ive compiled a bunch of ...

    i dont know why this error keeps showing plz help me.
    Code:
    /*  EX2-08Mayo-EX-Par2
       EX2-Par2
    */
    #include<stdio.h>
    #include<conio.h>
    #include<iostream.h>
    #include<string.h>
    int main(void)
    {
        int edad, estatura, estcentimetros, peso;
        char genero;
        printf ("Ingresa tu edad en aņos: \n");
        scanf ("%d", &edad);
        printf ("Ingresa tu genero, Hombre (H) o Mujer (M):");
        scanf ("%s", &genero);
        printf ("Ingresa tu estatura:");
        scanf ("%d", &estatura);
        printf ("Dame unicamente los centimetros:");
        scanf ("%d", &estcentimetros);
        printf ("Ingresa tu peso en kilogramos:");
        scanf ("%d", &peso);
    if(edad<18&&(genero=='M'||genero=='m')&&(estcentimetros==peso))
      {
      printf ("eres una persona sana");
     }
      if else((edad<18&&(genero=='M'||genero=='m')&&(estcentimetros<peso))
      {
      printf("falta de ejercicio");
      }
       else if((edad<18&&genero=='M' || genero=='m')&&(estcentimetros>peso))
      {
       printf ("falta una buena alimentacion");
       }
      else if((edad>=18&&(genero=='M' || genero=='m')&&(estcentimetros==peso))
       {
      printf("eres una persona sana");
      }
       else if((edad>=18&&genero=='M' || genero=='m')&&(estcentimetros<peso))
      {
       printf("falta de ejercicio");
       }
        else if (( edad>=18&&genero=='M' || genero=='m')&&(estcentimetros>peso))
        {
       printf("falta una buena alimentacion");
       }
       else if ((edad<18&&(genero=='H' || genero=='h')&&(estcentimetros==peso))
       {
        printf("eres una persona sana");
        }
         else if((edad<18&&genero=='H' || genero=='h')&&(estcentimetros<peso))
        {
         printf("falta de ejercicio");
         }
        else if((edad<18&&genero=='H' || genero=='h')&&(estcentimetros>peso))
         {
        printf("falta una buena alimentacion");
        }
         else if((edad>=18&&genero=='H' || genero=='h')&&(estcentimetos==peso))
        {
         printf("eres una persona sana");
         }
          else if((edad>=18&&genero=='H' || genero=='h')&&(estcentimetros<peso))
         {
          printf("falta de ejercicio");
          }
         else if((edad>=18&&genero=='H' || genero=='h')&&(estcentimetros>peso))
          {
         printf("eres una persona sana");
         }
    getchar();
    return 0;
    }
    ERROR CCP 35: If stat ement missing ( in function main ()

  2. #2
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    line 26
    Code:
    if else((edad<18&&(genero=='M'||genero=='m')&&(estcentimetros<peso))
    should be else if

    Kurt

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    4,633
    Look at the following snippet:
    Code:
      if else((edad<18&&(genero=='M'||genero=='m')&&(estcentimetros<peso))
    ...
       else if((edad<18&&genero=='M' || genero=='m')&&(estcentimetros>peso))
    Do you see anything different in these two statements.

    Also you really should consider finding a new compiler, Turbo-C++ is very outdated.


    Jim

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    All I see is C... did you intend to learn C or C++?
    And yes, do yourself a favour an get rid of Turbo C(++). Get GCC or Clang.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    No, it's C++, see the header?

    Code:
    #include<iostream.h>

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Maybe the OP just have created a header named iostream.h in his/her C project and included it? o_O
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by Elysia View Post
    Maybe the OP just have created a header named iostream.h in his/her C project and included it? o_O
    It would be "iostream.h" in that case...

  8. #8
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by manasij7479 View Post
    It would be "iostream.h" in that case...
    Not necessarily. Ever put a header in some predefined path and added it to the include path?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #9
    Registered User
    Join Date
    May 2013
    Posts
    2

    thank you so much!

    Thank you all so much i missed the "if else" there, still, i corrected it and still shows me the same 1 error. im really troubled by this and would rly apreciate your help.
    hehe, yes it is c++ but im a beginner and my teacher lay this homework on me so we have to use some ancient code lines...

  10. #10
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    Line 26:

    Code:
    // after making the correction already mentioned
    
    else if((edad<18&&(genero=='M'||genero=='m')&&(estcentimetros<peso))
    How many open parenthesis "(" do you see? How many close parenthesis ")" do you see?

    You did this in other places, too.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 03-12-2008, 12:10 AM
  2. Delete problem when compiled in C++
    By Hellwolf_36 in forum C++ Programming
    Replies: 8
    Last Post: 06-03-2007, 03:29 PM
  3. statement missing problem
    By nicop in forum C++ Programming
    Replies: 4
    Last Post: 06-29-2004, 11:48 AM
  4. Compiled If Statement
    By phatslug in forum C++ Programming
    Replies: 5
    Last Post: 08-03-2002, 08:49 PM
  5. I've compiled, but I don't know what the problem is.
    By iluvmyafboys in forum C++ Programming
    Replies: 5
    Last Post: 01-22-2002, 07:00 PM