JockVSJock
Technical User
Trying to get back into C++ and doing about an hr of programming on it for each day. I've writing a simple program where an end user inputs three #'s, and the output is a sum, product, and then it compares the three to see what is the largest and the smallest.
When I go to compile, I get an error on the first IF statement. I think I have it written right, but I get an error like it is looking for an ; to end the statement with. My code is below
thanks
-Chris
#include<iostream.h>
int main()
{
int iNum1, iNum2, iNum3;
cout<<"Enter three numbers \n";
cin>>iNum1>>iNum2>>iNum3;
cout<<"Input three different integers: " << iNum1 << iNum2 << iNum3;
cout<<endl;
int iSum;
iSum=iNum1+iNum2+iNum3;
cout<<"Sum is "<<iSum;
cout<<endl;
int iProduct;
iProduct=iNum1*iNum2*iNum3;
cout<<"Product is "<<iProduct;
cout<<endl;
if ( iNum1 < iNum2 ) && ( iNum1 < iNum3 );
{
cout<<"Smallest is "<<iNum1<<endl;
}
if ( iNum1 > iNum2 ) && ( iNum1 > iNum3 );
{
cout<<"Largest is "<<iNum1<<endl;
}
return 0;
}
When I go to compile, I get an error on the first IF statement. I think I have it written right, but I get an error like it is looking for an ; to end the statement with. My code is below
thanks
-Chris
#include<iostream.h>
int main()
{
int iNum1, iNum2, iNum3;
cout<<"Enter three numbers \n";
cin>>iNum1>>iNum2>>iNum3;
cout<<"Input three different integers: " << iNum1 << iNum2 << iNum3;
cout<<endl;
int iSum;
iSum=iNum1+iNum2+iNum3;
cout<<"Sum is "<<iSum;
cout<<endl;
int iProduct;
iProduct=iNum1*iNum2*iNum3;
cout<<"Product is "<<iProduct;
cout<<endl;
if ( iNum1 < iNum2 ) && ( iNum1 < iNum3 );
{
cout<<"Smallest is "<<iNum1<<endl;
}
if ( iNum1 > iNum2 ) && ( iNum1 > iNum3 );
{
cout<<"Largest is "<<iNum1<<endl;
}
return 0;
}