Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"//used for Visual Studio Prebuilt header
- #include <stdio.h>//used for getline
- #include <cmath>//used for pow //pow == Power to a # ->> Used for the function:// http://www.virtualnerd.com/algebra-1/radical-expressions-equations/pythagorean-theorem/pythagorean-theorem-examples/pythagorean-theorem-definition
- int _tmain(int argc, _TCHAR* argv[])
- {
- int L1 ;
- int L2 ;
- int L3;
- string L1s;
- while (true)
- {
- system("color 0a");
- cout<<"Please input length of triangle side 1: ";
- cin >> L1;
- cout<<"Please input length of triangle side 2: ";
- cin >> L2;
- cout<<"Please input length of triangle side 3: ";
- cin >> L3;
- if(L1 < L3 && L2 <L3)/*checks if the two angles that make up the triangle are less than the L3 angle == L3 is the hypotenuse.*/
- {
- int L1pyh = pow(L1, 2);
- int L2pyh = pow(L2, 2);
- int L3pyh = pow(L3, 2);
- if(L1pyh + L2pyh == L3pyh) //pythagorean-theorem
- {
- cout<<true<<endl;;
- getline(cin, L1s);
- }
- else
- {
- system("color 0e");
- cout<<false<<endl;;
- getline(cin, L1s);
- }
- }
- else
- {
- system("color 0");
- cout<<"Not a right angle triangle!\n";
- system("cls");
- }
- cout<<" ";
- getline(cin, L1s);
- system("color 0f");
- cout<<"Credits: BaSs_HaXoR";
- getline(cin, L1s);
- system("cls");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement