3
3than7
I am writing an application to solve Pythagorean Theorum Problems. This
is on my own time, i am using a book to learn c++, and after doing a
fahrenheit to celsuis program from that book, i wanted to try to make
something all be meself.
I have it working great to find the hypotenuse, but am having some
dufficulty making it produce a missing leg. As you know, a^2 + b^2 =
c^2
I have a variable that does the input for the one of the legs subtraced
from the hypotenuse, but i dont know where to go from there. PLEASE
help me, thanks~~3than7
TTHIS IS THE C++ I WROTE
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main( int nNumberofArgs, char* pszArgs[])
{
int wwi;
cout << "Press 1 to find the hypotenuse, press 2 to find a missing
leg: ";
cin >> wwi;
if (wwi == 1 ) {
int A;
int B;
//A^2 + B^2 = C^2 or the pythagorean Theorum
cout <<" Please enter A, do not square it!: ";
cin >> A;
cout <<" Please enter B, do not square it!: ";
cin >> B;
int C;
C = (A*A) + (B*B);
cout<< " C = ";
cout << C << " ";
cout << "";
cout << "";
}
if (wwi == 2) {
int Hypc;
cout << "Enter (C) the Hypotenuse: ";
cin >> Hypc;
int Leg;
cout << "Enter one of the legs: ";
cin >> Leg;
int F;
F = ( Hypc * Hypc ) - ( Leg * Leg ) ;
cout << "Missing leg is: ";
cout << << " " ;
}
system("PAUSE");
return 0;
}
~thanks again, 3than7
is on my own time, i am using a book to learn c++, and after doing a
fahrenheit to celsuis program from that book, i wanted to try to make
something all be meself.
I have it working great to find the hypotenuse, but am having some
dufficulty making it produce a missing leg. As you know, a^2 + b^2 =
c^2
I have a variable that does the input for the one of the legs subtraced
from the hypotenuse, but i dont know where to go from there. PLEASE
help me, thanks~~3than7
TTHIS IS THE C++ I WROTE
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main( int nNumberofArgs, char* pszArgs[])
{
int wwi;
cout << "Press 1 to find the hypotenuse, press 2 to find a missing
leg: ";
cin >> wwi;
if (wwi == 1 ) {
int A;
int B;
//A^2 + B^2 = C^2 or the pythagorean Theorum
cout <<" Please enter A, do not square it!: ";
cin >> A;
cout <<" Please enter B, do not square it!: ";
cin >> B;
int C;
C = (A*A) + (B*B);
cout<< " C = ";
cout << C << " ";
cout << "";
cout << "";
}
if (wwi == 2) {
int Hypc;
cout << "Enter (C) the Hypotenuse: ";
cin >> Hypc;
int Leg;
cout << "Enter one of the legs: ";
cin >> Leg;
int F;
F = ( Hypc * Hypc ) - ( Leg * Leg ) ;
cout << "Missing leg is: ";
cout << << " " ;
}
system("PAUSE");
return 0;
}
~thanks again, 3than7