The program is supposed to take in two numbers from the user and display them separated by a comma, with the smallest one displayed first. This program does run, so there are no syntax errors, but you need to correct it based on the following description.
The program is supposed to check and make sure that both numbers are positive. Only if they are positive, should it display the numbers separated by commas. If both numbers are not positive, the program should only display “Error: Negative Numbers!”.
Please correct the logic errors and submit updating comments at the top of the program.
For example, you do read in a "side". A triangle has three sides, does it not?
Does one "side" apply to all three?
If not, what other "dimentions" will you read?
To start with "double' is the preferred floating point type these days. A "double" has greater precision than a "float" and will store a number better. It also does a better job in calculations.
usingnamespace std; // <--- Best not to use.
In your for loops They are generally written as for (int y = 1; y <= sideVariable; y++). Unless you need to define the loop iterator outside of the for loop for later use it is best to specify the type of the iterator inside the for loop. (y++ ) is the form generally used and is the same as (y += 1).
It looks like line 34 is where you want to add to the program. Although "sideVariable" may not be the best name here it looks like you could use this variable for the height. To figure the perimeter, and area of a triangle you will need at least one more variable. I am thinking "base", but I never was very good at geometry.
You can put these calculations right in "main", but if you know about functions I would suggest using functions.
Your last bit of code would be to print out what you have done.
Come up with something and post it. Even if it is wrong or a problem at least it is something to work with.
you can find these 3 values with any of the standard S(ide) / A(ngle) combos if these are right triangles. eg SAS so the first thing to think about is how you want to input the data that defines your triangle, one way or all ways or via xy points or whatever. If they are not right triangles, you may want to just get x/y coordinates or the 3 side lengths.
once you have the triangle defined, the rest is pretty basic, but note that trig functions in c++ (and most languages) use radians for angles (easy convert, 180 degrees = pi radians). If its not a right triangle, you probably need trig to get the height.
One angle by using the cosine rule, then use this angle and a relevant side to get the "height". (Do you really need it? ... it's ambiguous - because there would be 3 possibilities - and you can get the area from Heron's formula anyway).
if you have the x/y coordinates of the 3 corners the height is pretty easy, its the biggest y value if its sitting on the x axis, and if not, a bit more logic to find it via coordinates but still not too bad. Distance formula...