Skip to content
Saturday, November 28, 2026Ideas worth exploring. Knowledge worth sharing.
S. SenseCentralDISCOVER EVERY DAY
C++ Programming

Numbers in C++

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;

}

Author

  • 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.

WRITTEN BY

Taylor Emma

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.

More from this author ↗

Leave a Reply

Your email address will not be published. Required fields are marked *