-
Notifications
You must be signed in to change notification settings - Fork 0
/
major.cpp
87 lines (68 loc) · 2.17 KB
/
major.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include<iostream>
#include<math.h>
using std::cin;
using std::cout;
using std::endl;
//we use the above lines instead of using namespace std; for space savings
float resultant_of_two_vectors(float a,float b,float c)
{
float d;
d=sqrt((a*a)+(b*b)+(2*a*b*cos(c*(M_PI/180))));
cout<<d<<"newtons"<<endl;
return d;
//try to update with the angle the resultant makes with the x and y axis.
}
float area_of_circle(float radius)
{
float area = M_PI*radius*radius;
cout<<area<<"metre square"<<endl;
return area;
}
//to find the firctional force,coeff_friction can be of kinamtic or static friction
float frictional_force(float coeff_friction,float newton)
{
float ff = coeff_friction*newton;
cout<<ff<<endl;
return ff;
}
//to find the area of a rectangle or square
float area_of_rectangle(float length,float breadth)
{
float area = length*breadth;
cout<<area<<endl;
return area;
}
float force(float mass,float accln)
{
float force = mass*accln;
cout<<force<<endl;
return force;
}
int main(){
//resultant of two vectors
int Force_1,Force_2,Angle;
cout<<"enter the first force second force (in newtons) and angle(in degree) between them in this respective order"<<endl;
cin>>Force_1>>Force_2>>Angle;
resultant_of_two_vectors(Force_1,Force_2,Angle);
//area of a circle
float radis;
cout<<"enter the radius of the circle in metres to get area of that particular circle"<<endl;
cin>>radis;
area_of_circle(radis);
//frictional force
float coefficientOfFriction,reactionForce;
cout<<"enter the coefficient of friction and reaction force"<<endl;
cin>>coefficientOfFriction>>reactionForce;
frictional_force(coefficientOfFriction,reactionForce);
//area of rectangle
float length,breadth;
cout<<"enter length and breadth of rectangle"<<endl;
cin>>length>>breadth;
area_of_rectangle(length,breadth);
//force equation
float mass,acceleration;
cout<<"enter mass and acceleration"<<endl;
cin>>mass>>acceleration;
force(mass,acceleration);
return 0;
}