SonniE
05-30-2008, 01:40 AM
This was coded by SonniE at 1am it works good
Try it Here (http://www.megaupload.com/?d=EGJ8XK75)
//Coded By SonniE An codinghs original
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double side, side2, hypotenuse;
char type;
char yn;
cout << "Welcome To SonniE's Triangle-Side Finder(Pythagorean Theorem) \nThis applies only to right Triangles\n";
step1:
cout << "Enter what side your looking for Leg = l, hypotenuse = h: ";
cin >> type;
if (type == 'l')
{
cout << "\nEnter The Hypotenuse's length: ";
cin >> hypotenuse;
cout << "Enter another Side of the triangle: ";
cin >> side;
side2 = sqrt((hypotenuse*hypotenuse) - (side*side));
cout << "The Missing Side's Length is: " << side2 << "\n";
cout << "Do you want to Enter another?";
cin >> yn;
if (yn == 'y')
{
goto step1;
}
if (yn == 'n')
{
goto step2;
}
}
else if (type == 'h')
{
cout << "Enter Side 1's Length: ";
cin >> side;
cout << "Enter Side 2's Length: ";
cin >> side2;
hypotenuse = sqrt((side*side) + (side2*side2));
cout << "The Missing Hypotenuse's Length is: " << hypotenuse << "\n";
cout << "Do you want to Enter another?";
cin >> yn;
if (yn == 'y')
{
goto step1;
}
if (yn == 'n')
{
goto step2;
}
}
step2:
return 0;
}
Try it Here (http://www.megaupload.com/?d=EGJ8XK75)
//Coded By SonniE An codinghs original
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double side, side2, hypotenuse;
char type;
char yn;
cout << "Welcome To SonniE's Triangle-Side Finder(Pythagorean Theorem) \nThis applies only to right Triangles\n";
step1:
cout << "Enter what side your looking for Leg = l, hypotenuse = h: ";
cin >> type;
if (type == 'l')
{
cout << "\nEnter The Hypotenuse's length: ";
cin >> hypotenuse;
cout << "Enter another Side of the triangle: ";
cin >> side;
side2 = sqrt((hypotenuse*hypotenuse) - (side*side));
cout << "The Missing Side's Length is: " << side2 << "\n";
cout << "Do you want to Enter another?";
cin >> yn;
if (yn == 'y')
{
goto step1;
}
if (yn == 'n')
{
goto step2;
}
}
else if (type == 'h')
{
cout << "Enter Side 1's Length: ";
cin >> side;
cout << "Enter Side 2's Length: ";
cin >> side2;
hypotenuse = sqrt((side*side) + (side2*side2));
cout << "The Missing Hypotenuse's Length is: " << hypotenuse << "\n";
cout << "Do you want to Enter another?";
cin >> yn;
if (yn == 'y')
{
goto step1;
}
if (yn == 'n')
{
goto step2;
}
}
step2:
return 0;
}