displaying how float, double and long double works in c++
#include<iostream>
using namespace std;
int main()
{
float a=3.14;
long double b=23.99;
cout<<"The size of 3.14 is:"<<sizeof(3.14)<<endl;//by default f is treated as double
cout<<"The size of 3.14f is:"<<sizeof(3.14f)<<endl;
cout<<"The size of 3.14F is:"<<sizeof(3.14F)<<endl;
cout<<"The size of 3.14l is:"<<sizeof(3.14l)<<endl;
cout<<"The size of 3.14L is:"<<sizeof(3.14L)<<endl;
return 0;
}
Comments
Post a Comment