Subscribe To Our Newsletter

Sign Up Now To Get Free Coupon Codes, Event Coupon Codes Updates, Offers Updates. It's 100% Free!

We Hate Spam! Really, It's terrible and we never do it.

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 Description is given below:
1) I love to read comments, but do not spam.
2) Like this blog and also tweet its posts.
3) You can use some xHTML tags.
4) All Comments are Do Follow, Please try to use blog professionally.
5) Mention Your Name below the comment.
6) You can also suggest for improvement.
7) Do not forget to subscribe Samee Articles blog.

---------------------------------------
Thanks for visiting QWC.Me.
==========================================
For free guidelines contact me on SEO Expert | Samee Ullah Feroz is online there.
==========================================
Best Regards

 
Support : | Internet Marketing Specialist And Business Developer
Copyright © 2013-2016. Samee Articles - All Rights Reserved
Proudly powered by Blogger