PROGRAM TO PRINT SIZE OF DATATYPES

/*PROGRAM TO PRINT SIZE OF DATATYPES*/

#include<conio.h>

#include<iostream.h>

class size

{

int i,f,c,li,d,ld;

public:

void calculate();

};

void size::calculate()

{

i=sizeof(int);

f=sizeof(float);

c=sizeof(char);

li=sizeof(long int);

d=sizeof(double);

ld=sizeof(long double);

cout<<“Size of integer: “<<i<<endl;

cout<<“Size of float: “<<f<<endl;

cout<<“Size of character: “<<c<<endl;

cout<<“Size of long integer: “<<li<<endl;

cout<<“Size of double: “<<d<<endl;

cout<<“Size of long double: “<<ld<<endl;

}

void main()

{

size s1;

clrscr();

s1.calculate();

getch();

}

Leave a Reply

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