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;

}

Related Posts

© 2024 Software Engineering - Theme by WPEnjoy · Powered by WordPress