Numbers in C++

Taylor Emma
0 Min Read
Disclosure: This website may contain affiliate links, which means I may earn a commission if you click on the link and make a purchase. I only recommend products or services that I personally use and believe will add value to my readers. Your support is appreciated!

Following a simple example to show few of the mathematical operations on C++ numbers:

#include<iostream>

#include<cmath>

usingnamespacestd;

int main ()

{

// number definition:

short  s=10;

inti=-1000;

long   l =100000;

float  f=230.47;

double d =200.374;

// mathematical operations;

cout<<“sin(d) :”<< sin(d)<<endl;

cout<<“abs(i)  :”<< abs(i)<<endl;

cout<<“floor(d) :”<< floor(d)<<endl;

cout<<“sqrt(f) :”<<sqrt(f)<<endl;

cout<<“pow( d, 2) :”<< pow(d,2)<<endl;

return0;

}

Share This Article
A senior editor for The Mars that left the company to join the team of SenseCentral as a news editor and content creator. An artist by nature who enjoys video games, guitars, action figures, cooking, painting, drawing and good music.
Leave a review