Hey guys, I was wondering if you could help me out on an assignment I have to do for my introductory programming class.
Here is the link to the assignment:
http://www.cs.uwm.edu/classes/cs201/.../04/04/04.html
And here is my code so far:
Code:
#include <iostream>
using namespace std;
int main ()
{
//Declare variables.
float A;
float B;
float C;
//Get lengths of triangle.
cout << "Please enter the triangle lengths:" << endl;
cout << "length 1: ";
cin >> A;
cout << "length 2: ";
cin >> B;
cout << "length 3: ";
cin >> C;
//Order the lengths.
if (A>B)
{
float temp;
temp = A;
A = B;
B = temp;
}
if (A>C)
{
float temp;
temp = A;
A = C;
C = temp;
}
if (B>C)
{
float temp;
temp = B;
B = C;
C = temp;
}
//Display order.
cout << "Lengths in nondecreasing order: "<< A << "," << B << ","
<< C <<endl;
return 0;
}
Everything seems right so far...but I'm stuck as where to go from here. I have a lot of trouble with functions!
Any suggestions would be appreciated!
Thanks in advance!