0% found this document useful (0 votes)
20 views

Manual # 1

The document provides an introduction to using formulas in C++. It includes examples of using common mathematical operations like addition, subtraction, multiplication and division. It also demonstrates how to use trigonometric, logarithmic and other advanced math functions by including the math.h header file. The examples show how to calculate things like absolute value, exponents, square roots, sines, cosines, tangents and their inverses using C++ output statements.

Uploaded by

musa
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Manual # 1

The document provides an introduction to using formulas in C++. It includes examples of using common mathematical operations like addition, subtraction, multiplication and division. It also demonstrates how to use trigonometric, logarithmic and other advanced math functions by including the math.h header file. The examples show how to calculate things like absolute value, exponents, square roots, sines, cosines, tangents and their inverses using C++ output statements.

Uploaded by

musa
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 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