CPP01- Write a CPP program to find size and print the all basic data types of C++.

By | October 15, 2018

Write a CPP program to find size and print the all basic data types of C++.

CODE:-

#include<iostream.h>
#include<conio.h>
void main()
{
char c=’c’;
int i=123;
short s=12;
long l=98775345;
float f=456.789;
double d=12345.6789;
clrscr();
cout << “Value of char   : ” << c << endl;
cout << “Value of int    : ” << i << endl;
cout << “Value of short  : ” << s << endl;
cout << “Value of long   : ” << l << endl;
cout << “Value of float  : ” << f << endl;
cout << “Value of double : ” << d << endl;
getch();
}

#include<iostream.h>
#include<conio.h>
void main()
{
char c='c';
int i=123;
short s=12;
long l=98775345;
float f=456.789;
double d=12345.6789;
clrscr();
cout << "Value of char   : " << c << endl;
cout << "Value of int    : " << i << endl;
cout << "Value of short  : " << s << endl;
cout << "Value of long   : " << l << endl;
cout << "Value of float  : " << f << endl;
cout << "Value of double : " << d << endl;
getch();
}

SCREEN SHOTS:-

CPP_program_Find_All_Operator

OUTPUT:-

CPP_program_Find_All_Operator_Out

 

CODE:-

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
cout << “Size of char   : ” << sizeof(char)   << endl;
cout << “Size of int    : ” << sizeof(int)    << endl;
cout << “Size of short  : ” << sizeof(short)  << endl;
cout << “Size of long   : ” << sizeof(long)   << endl;
cout << “Size of float  : ” << sizeof(float)  << endl;
cout << “Size of double : ” << sizeof(double) << endl;
getch();
}

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
cout << "Size of char   : " << sizeof(char)   << endl;
cout << "Size of int    : " << sizeof(int)    << endl;
cout << "Size of short  : " << sizeof(short)  << endl;
cout << "Size of long   : " << sizeof(long)   << endl;
cout << "Size of float  : " << sizeof(float)  << endl;
cout << "Size of double : " << sizeof(double) << endl;
getch();
}

SCREEN SHOTS:-

CPP_program_Find_Size_Operator

OUTPUT:-

CPP_program_Find_Size_Operator_Out