Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int pythag(double a, double b);
- int pythag2(double b, double c);
- int pythag3(double c, double a);
- int main()
- {
- double a;
- double b;
- cout << "Pythagorean theorem, Enter sides A and B and I will solve for C" << endl;
- cin >> a >> b;
- cout << "Side C is equal to " << pythag(a, b) << endl;
- cout << "Now input for Side A" << endl;
- cin >> a >> b;
- cout << "Side A is equal to " << pythag2(b, a) << endl;
- cout << "Now input for Side B" << endl;
- cin >> a >> b;
- cout << "Side B is equal to " << pythag3(b, a) << endl;
- return 0;
- }
- int pythag(double a, double b)
- {
- double side1 = sqrt(pow(a, 2.0) + pow(b, 2.0));
- return side1;
- }
- int pythag2(double b, double c)
- {
- double side2 = sqrt(pow(c, 2.0) - pow(b, 2.0));
- return side2;
- }
- int pythag3(double c, double a)
- {
- double side3 = sqrt(pow(c, 2.0) - pow(a, 2.0));
- return side3;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement