Like Tree1Likes
  • 1 Post By Elysia

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

This is a discussion on Problem with if else on turbo c ++, if statement missing, ive compiled a bunch of ... within the C++ Programming forums, part of the General Programming Boards category; 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> ...

  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
    ZuK
    ZuK is offline
    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
    2,915
    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
    Posts
    22,985
    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
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,655
    No, it's C++, see the header?

    Code:
    #include<iostream.h>

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,985
    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
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,523
    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...
    Manasij Mukherjee | gcc-4.9.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  8. #8
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,985
    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?
    manasij7479 likes this.
    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
    2,690
    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, 01:10 AM
  2. Delete problem when compiled in C++
    By Hellwolf_36 in forum C++ Programming
    Replies: 8
    Last Post: 06-03-2007, 04:29 PM
  3. statement missing problem
    By nicop in forum C++ Programming
    Replies: 4
    Last Post: 06-29-2004, 12:48 PM
  4. Compiled If Statement
    By phatslug in forum C++ Programming
    Replies: 5
    Last Post: 08-03-2002, 09: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

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