Well its fairly self explanatory, its a program that shows that calculates the hypotenuse using the pythagorean theorum, It displays the values of the sides and shows a crappy ascii art right triangle with the values input and the later found values

160 Views
``````#include <math.h>
#include <iostream>
using namespace std;
int main()
{
cout<<"This program will find the hypotenuse of a right triangle.\n";
cout<<" |\\\n";
cout<<" | \\\n";
cout<<"A|  \\C\n";
cout<<" |   \\\n";
cout<<"  ----\n";
cout<<"   B\n";
int a, b, c, x, y, z, answer;
starta: cout<<"Enter value of side A:";
cin>> a;
if (a<=0){cout<<"A side cannot to be less than or equal to 0\n";goto starta;}
startb:cout<<"Enter value of side B:";
cin>> b;
if (b<=0){cout<<"A side cannot to be less than or equal to 0\n";goto startb;}
cout<<" |\\\n";
cout<<" | \\\n";
cout<<a<<"|  \\C\n";
cout<<" |   \\\n";
cout<<"  ----\n";
cout<<"   "<<b<<"\n";
x=a*a;
y=b*b;
z=x+y;
cout<<pow(a,2)<<"+"<<pow(b,2)<<"="<< z <<".\n";
z=x+y;
pow(z,0.5);
cout<<" |\\\n";
cout<<" | \\\n";
cout<<a<<"|  \\"<<sqrt(z)<<"\n";
cout<<" |   \\\n";
cout<<"  ----\n";
cout<<"   "<<b<<"\n";
cout<<"Side C is "<< sqrt(z) <<".\n";
system("PAUSE");
return 0;
}``````