I m having hard time to fix my code.
I need to find the largest integers among three integers and also
need to display when all three integers are equal.
I didn't have an error with my code, but when all numbers are equal,
it says third numbers are the largest and its equal.
I need to fix it.
#include<iostream>
using namespace std;
int main()
{
int num1, num2, num3;
cout << " Enter value for first number";
cin >> num1;
cout << " Enter value for second number";
cin >> num2;
cout << " Enter value for third number";
cin >> num3;
if (num1>num2&&num1>num3)
{
cout << " First number is greatest:" << endl << "whick is= " << num1;
}
else if (num2>num1&&num2>num3)
{
cout << " Second number is greatest" << endl << "whick is= " << num2;
}
else
{
cout << " Third number is greatest" << endl << "whick is= " << num3;
}
if (num1=num2=num3)
{
cout << " All numbers are equal" << endl << "which is=" << num1, num2, num3;
}
Well if all the numbers are equal ehy would you want to show the value of num1, num2, and num3. Since they are all equal just cout 1 of them to show what the number is