#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<math.h>
main()
{
      system("cls");
      int h,w,m;
      cout<<"Press1,if you are male"<<endl;
      cout<<"press2,if you are female"<<endl;
      cin>>m;
      if(m==1)
      {
              cout<<"you are male"<<endl;
      }
      if(m==2)
      {
              cout<<"you are female"<<endl;
      }
      cout<<"Enter your height=";
      cin>>h;
      cout<<"Enter your weight=";
      cin>>w;
      if(m==1)
  {
      if(h<60)
    {
      cout<<"you are unfit";
    }
      if(h>=60&&h<65)
    {
      if(w<45)
      cout<<"you are unfit";
      if(w>=45&&w<55)
      cout<<"you are fit";
      if(w>=55&&w<60)
      cout<<"you are acceptable";
      if(w>=60)
      cout<<"you are unfit";
    }
      if(h>=60&&h<70)
    {
       if(w<55)
       cout<<"you are unfit";
       if(w>=55&&w<65)
       cout<<"you are fit";
       if(w>=65&&w<75)
       cout<<"you are acceptable";
       if(w>=75)
       cout<<"you are unfit";
    }
       if(h>=70)
       cout<<"you are unfit";
  }
       if(m==2)
  {
       if(h<54)
    {
       cout<<"you are unfit";
    }
       if(h>=54&&h<60)
    {
       if(w<40)
       cout<<"you are unfit";
       if(w>=40&&w<50)
       cout<<"you are fit";
       if(w>=50&&w<55)
       cout<<"you are acceptable";
       if(w>=55)
       cout<<"you are unfit";
    }
       if(h>=60&&h<64)
    {
       if(w<45)
       cout<<"you are unfit";
       if(w>=45&&w<55)
       cout<<"you are fit";
       if(w>=55&&w<60)
       cout<<"you are acceptable";
       if(w>=60)
       cout<<"you are unfit";
    }
       if(h>=64)
       cout<<"you are unfit";
    }
       getche();
} 

Is there a question, or would you like us to just point out everything that is wrong with this program?

For Turbo C, it may be. For C++ standard, it's not.

Adding to what CGSMCMLXXV says, this code is possibly what some people might have called C++ twenty years ago before C++ was standardised. This would not compile on a modern, correct C++ compiler (and indeed, would not compile on any decent C++ compiler written since 1998).

Here is a brief summary of problems:

  • Headers are wrong - they haven't been like that since before 1998 (and you include the non-standard conio)
  • Related to the bad headers, no use of namespaces
  • main returns an int. Always.main() is just plain wrong.
  • Non-portable system calls. They're dangerous, unnecessary and expensive.
  • No handling of unexpected input (what happens if user enters "3"?)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.