check out code error ?

I'm suppose to write a code that tests if the dimensions a user has entered equals a cube..

I thought it worked but now I'm testing it and its only working if the user inputs 1 as the length, width and height.. Am i missing something ? It's a very simple code but it's not working.. :(

cout << "Is your object a cube? " << endl; //message displayed

cout << "Please enter the length: " << endl;
cin >> length; // user will input length

cout << "Great! Now enter width: " << endl;
cin >> width; // user will input desired width

cout << "OK, Now enter height: " << endl;
cin >> height; // user will input height

if (length == width == height)
cout << "Your object is a cube!! \n";
else
cout << "Your object is not a cube \n";
You dont have to post twice, You can continue your question in the other thread next time.

Also, Use Code tags for all of your code. Its under the format section and looks like this <>.
http://www.cplusplus.com/articles/jEywvCM9/

if (length == width == height)

You cant do this. Change it to

if (length == width && width == height)
thank you!
Topic archived. No new replies allowed.