14 Nov 2011

C++ If-Else and Do-While Loop


using C++ If-Else statement and Do-While Loop to find the smaller number
#include<iostream.h>
#include<conio.h>
main()
{
char m;
do
{
clrscr();
int i,j;
cout<<"\n\t\tEnter First Number=";
cin>>i;
cout<<"\n\t\tEnter second number=";
cin>>j;
if(i<j)
{
cout<<"\n\t\tFirst number is Smaller"<<endl;
}
else
{
cout<<"\n\t\tSecond number is Smaller"<<endl;
}
cout<<"\t\t\tTo stop the process press \"s\" and"<<endl;
<<"\t\t\t"<<"To continue press any key"<<endl;
m=getche();
}
while(m!='s' && m!='S');
return 0;
}

No comments:

Post a Comment