Find size of data types
//This programme is tested on visual studio 2012//
#include <iostream>
using namespace std;
void main ()
{
int in,size_in,size_ch;
float fl,size_fl;
double db, size_db;
long lg,size_lg;
short sh,size_sh;
char ch;
cout<<"------------------------------------------------------------------------------\n";
cout<<"This programme will print size of data types.\n";
cout<<"------------------------------------------------------------------------------\n";
cout<<"Enter int = ";
cin>>in;
size_in=sizeof (in);
cout<<"The size of data typy (integer) = "<<size_in<<endl;
cout<<"Enter float = ";
cin>>fl;
size_fl=sizeof (fl);
cout<<"The size of data type (float) = "<<size_fl<<endl;
cout<<"Enter double = ";
cin>>db;
size_db=sizeof (db);
cout<<"The size of data type (double) = "<<size_db<<endl;
cout<<"Enter long = ";
cin>>lg;
size_lg=sizeof (lg);
cout<<"The size of data type (long) = "<<size_lg<<endl;
cout<<"Enter short = ";
cin>>in;
size_sh=sizeof (sh);
cout<<"The size of data type (short) = "<<size_sh<<endl;
cout<<"Enter Char = ";
cin>>ch;
size_ch=sizeof (ch);
cout<<"The size of data type (Char) = "<<size_ch<<endl;
cout<<"\n\n------------------------------------------------------------------------------\n";
cout<<"Thank You for using.\n\nVisit http://bilalzahid22.blogspot.com/ for more\n";
cout<<"\n------------------------------------------------------------------------------\n";
}


0 comments:
Post a Comment