Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float getSide();
- float calcSideC(float sideA, float sideB);
- float displaySideC(float sideC);
- int main()
- {
- float sideA;
- float sideB;
- float sideC;
- cout << "Side A: \n";
- sideA = getSide();
- cout << "Side B: \n";
- sideB = getSide();
- sideC = calcSideC(sideA, sideB);
- displaySideC(sideC);
- system("pause");
- return 0;
- }
- float getSide()
- {
- float sideInput;
- cout << "Enter a side of a right triangle." << endl;
- cin >> sideInput;
- return sideInput;
- }
- float calcSideC(float sideA, float sideB)
- {
- float sideC;
- sideC = pow(sideA, 2) + pow(sideB, 2);
- return sideC;
- }
- float displaySideC(float sideC)
- {
- cout << "\nThe dimension of Side C is: " << sqrt(sideC) << endl << endl;
- return 0;
- }
- /*OUTPUT
- Side A:
- Enter a side of a right triangle.
- 3
- Side B:
- Enter a side of a right triangle.
- 4
- The dimension of Side C is: 5
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement