0% found this document useful (0 votes)
86 views1 page

C++ Codes

This C++ program uses trigonometric functions and formulas to calculate the missing side length and area of an oblique triangle given two sides and the angle between them. It prompts the user to input the known values, applies the law of cosines to find the missing side, and uses the area formula for oblique triangles to output the calculated area.

Uploaded by

Jahannie Sarip
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views1 page

C++ Codes

This C++ program uses trigonometric functions and formulas to calculate the missing side length and area of an oblique triangle given two sides and the angle between them. It prompts the user to input the known values, applies the law of cosines to find the missing side, and uses the area formula for oblique triangles to output the calculated area.

Uploaded by

Jahannie Sarip
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include <iostream>

#include <cmath>

using namespace std;

int main()
{
float angle1, distance, side1, side2, angle, cosine, squared, area; //the variables and data type
const float Pl= 3.14159265358979323846; // the pi
cout <<"Find the missing value of one side and the area "<<endl;
cout <<"using the law of cosine and the formula for the area of oblique triangles."<< endl; //A
sentence

//output

cout<<"Enter the value of one side: ";//sentence


cin >> side1;//input number
cout <<"Enter the value of the angle: ";//sentence
cin >> angle;//input number
cout <<"Enter the value of other side: "; //sentence
cin>> side2;//input number

angle1 = (angle* Pl/180); //turning degree into radiant


distance = pow(side1,2) + pow(side2,2)-(2* side1* side2*cos(angle1));//formula of the law of
cosine
squared = sqrt(distance); // square rooted the number with the square root library function
area = (0.5* side1* side2* sin(angle1)); //formula of area for oblique triangles
cout <<"The distance of it is: "<<squared<<","<<endl;//output
cout <<"The area of the triangle is: "<<area<<",";//output

You might also like