If Else Statement in C++

The general form of an if statement which includes the else(if…..else) clause is:

 

If(expression) statement1(true) else statement2;

The following, for example, program uses a nested if…..else construct to check if the input character is uppercase or lowercase.

#include<iostream.h>

#include<conio.h>

void main()

{

char inp;

cout<<"enter a character";

cin>>inp;

if(inp>='A')

if(inp<='Z')

cout<<endl<<"Uppercase";

else if(inp>='a')

{

if(inp<='z')

cout<<endl<<"LowerCase";

else

cout<<endl<<"Input Character>z";

}

else

{

cout<<"input the character btw z to a”;

}

else

{

cout<<"Input Character btw A to Z";

}

getch();

}

Output...

If Else Statement