Hello, im still new in C++ so i need some help with this program im experimenting with the if-else statements. Please help if anyone can.
[Code]
//This program is to be used to show the greatest value out of the three numbers which is
//inputted by the user.
#include <iostream.h>
void main()
{
int num1, num2, num3;
//The three numbers variable that are to be inputted by the user
cout<<"Please input any three numbers. \n";
cin>>num1>>num2>>num3;
//The method of solving this is most likely by using the if-else statement
if (num1>num2&&num3)
cout<<num1<<" is the greatest number of all. \n";
else if (num2>num1&&num3)
cout<<num2<<" is the greatest number of all. \n";
else if (num3>num1&&num2)
cout<<num3<<" is the greatest number of all. \n";
}
[*Code]
The above is the code, i don't know wats wrong with it but when i execute the program; after inputting the 3 numbers the only numbers that are considered are num1 and num2. Whilst even if num3 is actually larger it does not display num3 rather displays the second largest number of the system. So please anyone help me with this.