Friday, August 7, 2009

THE ELSE STATEMENT

The if statement lets a program decide whether a particular statement or block is executed.the if else statement lets a programme decided which of two statements or blocks is executed.It's an invaluable statement for creating alternative course of action.
The if else statement has this general form
If (test condition)
statement1
else
satement 2
if test-condition is nonzero the programexecutes statement 1 and skips over statement2.Ohterwise when test condition is zero(false),the program skips statement1 and executes and executes statement 2 instead.
Here is an example program
include
void main()
{
int bas;
cout<<"enter basic salary"
cin>>bas;
if(bas>1000)
cout<
cout<<>
}


No comments:

Post a Comment