Question #249345


  • There are several data types in C++ namely built-in data types and enumerated datatypes and class types. Now you have to write a C++ program that reads the file compiled using C++ compiler successfully. The output of the file must display in tabular column the name of the data type and how many times it is used in program. that means how many integers are declared, how many classes declared and instantiated etc.




Expert's answer

#include <iostream>
using namespace std;


int main()
{
    double d;
	char c;
	int i;
	float f;
	cout << "Size of double is: " <<
	sizeof(d) <<"\n";
	cout << "Size of char is: " <<
	sizeof(c) <<"\n";
	cout << "Size of int is: " <<
	sizeof(i) <<"\n";
	cout << "Size of float is: " <<
	sizeof(f) <<"\n";
	return 0;
}

LATEST TUTORIALS
APPROVED BY CLIENTS