C++ | Beginning Functions > Using math library functions | Lecture 4

math library functions

 Using Math Library Beginning Functions:

Here you will learn about Math Library Beginning Functions. Like
  1. Cos
  2. Sin
  3. Tan
  4. Sqrt
  5. Pow
  6. Log
  7. And More
But here, I'll just discuss one function that is
sqrt function >> Square root function >> text with the √ symbol
In below given code, you will learn that
1st) You should add
#include <cmath>
into the header. It is mathematics library in C Plus Plus, in which you can find all important math functions.
double num2;
num2 = sqrt (num1);
Here I am taking the square root of num1 variable. likewise, you just need to try same functionality to all math type functions.

 /*  
  Name: beginning functions   
  Copyright: sameearticles.blogspot.com  
  Author: Samee Ullah Feroz  
  Date: 26/01/14 23:49  
  Description: Using Math library functions....  
 */  
 #include <iostream>  
 #include <cmath> //it is for all math functions library  
 int main() //it is actually a function here  
   {  
    using namespace std;  
    double num1;  
    cout << "pick your number...." << endl;  
    cin >> num1;  
    double num2;  
    num2 = sqrt(num1); // variable not in quotes  
    cout << "The square root of = " << num1 << " is " << num2 << endl;  
    system("pause");  
    return 0;  
   }  

Try it.
Share this article :

Post a Comment

Give your reviews about this blog. Leave your comments. What do you think about this post?

Comments Guidelines:

1) I love to read comments, but please avoid spam.

2) Like this blog, share your insights, and spread the word.

3) You can use basic HTML/xHTML tags.

4) All comments are DoFollow—please use the section professionally.

5) Kindly mention your name or brand below your comment.

6) Constructive suggestions for improvement are always welcome.

7) Do not forget to explore our main agency platform at pingbooster.site.

Thanks for visiting Samee Articles.

========================================

Explore custom digital solutions and WordPress plugins at PingBooster Plugins.

Best Regards,

Samee U. Feroz

 
Copyright © 2013-2016. Samee Articles - All Rights Reserved
Proudly powered by Blogger