You are on page 1of 2

Manual # 1

Topic:
Use of Formula`s in C++

Subject:
Introduction to Computing

Author:
Engr. Ali Faisal Murtaza
---------------------------------------------------------------------------------
Q#1: Write a program, which will display your name.
---------------------------------------------------------------------------------
Q # 2: Execute the following formula`s in C++:

Use of Addition, Subtraction, Multiplication & Division


Addition: cout<<4+2<<"\n";
Subtraction: cout<<2-6<<”\n”;
Multiplication: cout<<3*8<<”\n”;
Division: cout<<6/3<<”\n”;

For Formula below, you have to include the header file: math.h (#include<math.h>)
Absolute: cout<<abs(-8)<<”\n” ;means that it will give modulus of value given i.e. +ive
value
Exponent: cout<<exp(6)<<”\n”;
Power: cout<<pow(2,9)<<"\n"; means that 2 raise to power 9 i.e. 2^9.
Square Root: cout<<sqrt(16)<<”\n”;

Logarithm & Trigonometric Functions:


Natural Algorithum: cout<<log(3)<<”\n”; Gives the natural logarithm of 3.
Sine: cout<<sin(45)<<”\n”; Gives the Sine value of 45 degrees in radians.
Cosine: cout<<cos(45)<<”\n”; Gives the cosine value of 45 degrees in radians.
Tangent: cout<<sin(45)<<”\n”; Gives the Tangent value of 45 degrees in radians.
Inverse of Sine: cout<<asin(30)<<”\n”; Gives the inverse sine of 30 degrees in radians.
Inverse of Cosine: cout<<acos(30)<<”\n”; Gives the inverse cosine of 30 degrees in
radians.
Inverse of Tangent: cout<<atan(30)<<”\n”; Gives the inverse tangent of 30 degrees in
radians.
Hyperbolic Sine: cout<<sinh(60)<<”\n”; Gives the hyperbolic sine of 60 degrees
in radians.
Hyperbolic Cosine: cout<<cosh(60)<<”\n”; Gives the hyperbolic cosine of 60 degrees
in radians.
Hyperbolic Tangent: cout<<tanh(60)<<”\n”; Gives the hyperbolic tangent of 60 degrees
in radians.
------------------------------------------------------------------------------------------------------------

You might also like