include<iostream>

using namespace std;

#include<iostream>
using namespace std;
void main()
{
int a ,b,c;

cout<< "Enter three integers"<<endl;
cin>>a,b,c;

if (a<b && a<c)

    cout<<"a is less"<<endl;
if (b<c && b<a)

    cout<<("b is less");

if (c<a && c<b)

    cout<<"c is less"<<endl;

else
cout<<"all numbers are the same"<<endl;

};

I GET A initializing error with variable b

Take another look at this line:

cin>>a,b,c;

Double-check how to handle multiple values with cin.

ok thanks i get it

Also, use int main() instead of void main().
And there seems to be a syntax error on line 24.

ok thanks i get it
 THe code is working except it keeps saying all numbers are the same when they are not

     #include<iostream>
    using namespace std;
    void main()
    {
    int a ,b,c;
    cout<< "Enter three integers"<<endl;
    cin>>a>>b>>c;
    if (a<b && a<c)
    {
    cout<<a<< "is less"<<endl;
    }
    if (b<c && b<a)
    {
    cout<<b<< "is less";
    }
    if (c<a && c<b)
    {
    cout<<c<<" is less"<<endl;
    }
    else
    {
    cout<<"all numbers are the same"<<endl;
    }
    };

Just double-check your logic with your if-else statements. At the moment it will say all numbers are the same if c is larger than either a or b.

else if (a==b==c)
    {
    cout<<"all numbers are the same"<<endl;
    }

    I tried this but the compiler ignored it

You're effectively checking that a is equal to b and a is equal to c.

You're effectively checking that a is equal to b and a is equal to c.

You mean checking if a is equal to b is equal to c. Or in other words, if a == b and c == 1 or a != b and c == 0. The result of a boolean test is 0 or 1, and the evaluation is ((a == b) == c). Or in multiple lines, which highlights the problem more readily:

int temp = (a == b);

if (temp == c) {
   ...
}

@ orar

You can do the problem in this way also, I will only provide a part of it :

Check if a > b
  If this is true check a > c
     If this is true output a is largest

     else c is largest

This is only a part of the code. As you can see if a < b is false, obviously you must check whether b > c or not. If true, think what should you do, if not, again, think what should you do.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.