I am trying to make a program that will state the smallest number entered, with only 2 numbers it works.
With 3 or more numbers it prints all the values as the smallest as if quoting the values entered.Code:if ( x > y ) cout << "Smallest: " << x << endl; if ( y > x ) cout << "Smallest: " << y << endl;
I have only just started leaning c++ so if someone could please help it would be apprieciated. I have tried to work this out myself but must be missing something really simple.Code:if ( x > y , z ) cout << "Smallest: " << x << endl; if ( y > x , z ) cout << "Smallest: " << y << endl; if ( z > y , x ) cout << "Smallest: " << z << endl;



LinkBack URL
About LinkBacks


