I am making a prog to display the largest out of three numbers and i am stuck real bad. Pls help :) Thanx in advance.
// Just Rahul Prog-9
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b=1;
cout<<"\t\tPROGRAM TO FIND LARGEST OF THREE +VE NUMBERS:-";
for(int x=1;x++;x<=3);
{
cout<<"\nEnter a number=";
cin>>a;
if(a>=b);
{
b=a;
}
}
getch();
}
Did just like you said but still the loop doesn't iterate more than once.
// Just Rahul Prog-9
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b;
cout<<"\t\tPROGRAM TO FIND LARGEST OF THREE +VE NUMBERS:-";
for(int x=1;x++;x<=3);
{
cout<<"\nEnter a number=";
cin>>a;
if(a>=b);
{
b=a;
}
}
cout<<"Largest number is="<<b;
getch();
}