0% found this document useful (0 votes)
5 views8 pages

Triangle Calculations Program Code

The document outlines a program that calculates various properties of a 90-degree triangle using the hypotenuse and one angle as inputs. It includes formulas for the opposite side, adjacent side, angle theta, perimeter, and area, along with a sample program code in C++. The document also provides an example of input and output for the program.

Uploaded by

ragustilo27
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views8 pages

Triangle Calculations Program Code

The document outlines a program that calculates various properties of a 90-degree triangle using the hypotenuse and one angle as inputs. It includes formulas for the opposite side, adjacent side, angle theta, perimeter, and area, along with a sample program code in C++. The document also provides an example of input and output for the program.

Uploaded by

ragustilo27
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Reporting (Program

Code, Input, and


Output)

MEMBERS:
Name of members
DESCRIPTION:
This program is utilized to calculate the value of the
opposite side, adjacent side, measure of angle theta,
perimeter, and area of a 90-degree triangle based on
the input values of the hypotenuse and one angle
with the use of the trigonometric function. The
hypotenuse and angle 1 are the input values to be
used in calculating the adjacent side, opposite side,
and angle theta. Side 1, side 2, and hypotenuse are
the values to be used in calculating the perimeter,
and side 1 and side 2 are to be used in calculating
the area. The input values are the hypotenuse and
the angle 1.
ALGORITH
1. Assign the input values as hypotenuse and
angle 1.

M:
2. The formula to calculate the opposite side is s1
= hyp * sin (a1 * (0.01745329252)).
3.. The formula to calculate the adjacent side is
s2 = hyp * cos (a1 * (0.01745329252)).
4. The formula to calculate the angle theta is a2 =
90 - a1.
5. The formula to calculate the perimeter is p = s1
+ s2 + hyp.
6.. The formula to calculate the area is a = (0.5 *
s1 * s2).
7. Display the input values and the calculated
FLOWCH
ART:
Program code:
#include <iostream> double hyp, a1;
#include <cmath> double s1, s2, a2, p, a;
#include <string>
cout << setw (20) << "Enter Hypotenuse:";
#include <iomanip>
using namespace std;
cin >> hyp;
int main () cout << setw (20) << "Enter Angle(in degrees):
{ cin >> a1;
string lname, fname, cs, date; s1 = hyp * sin (a1 * (0.01745329252));
cout << "Last Name: "; s2 = hyp * cos (a1 * (0.01745329252));
cin >> lname; a2 = 90 - a1;
cout << "First Name: "; p = s1 + s2 + hyp;
cin >> fname; a = (0.5 * s1 * s2);
cout << "Enter your course and section:
cout";<< endl;
cin >> cs;
cout << "Enter the date today(mm-dd-yy): ";
cin >> date;
cout << fixed << showpoint << setprecision (2);
cout << endl;
cout << setw (50) << "Name: " << fname << " " <<
lname << endl;
cout << setw (50) << "Course and Section: " << cs <<
endl;
cout << setw (50) << "Date: " << date << endl <<
endl;
cout << setw (50) << "Hypotenuse Side: " << hyp <<
endl;
cout << setw (50) << "Given Angle: " << a1 << "
degrees" << endl << endl;
cout << setw (50) << "The Unknown sides and angles
are: " << endl;
cout << setw (50) << "Adjacent Side: " << s2 << endl;
cout << setw (50) << "Opposite Side: " << s1 << endl;
cout << setw (50) << "Angle Theta: " << a2 << "
degrees" << endl <<endl;
cout << setw (50) << "The perimeter and area of the
triangle are:" << endl;
cout << setw (50) << "Perimeter: " << p << endl;
cout << setw (50) << "Area: " << a << endl;
return 0;
Input:
Last Name: Guardafe
First Name: Krizia
Enter your course and section:
BSCE-E22 Enter the date today (mm-
dd-yy): 09-29-21
Enter hypotenuse: 8
Enter angle (in degrees): 30
Output:
Name: Krizia Guardafe
Course and Section: BSCE-E22
Date: 09-29-21

Hypotenuse: 8.00
Enter angle (in degrees): 30

You might also like