Please send questions to
st10@humboldt.edu .
#include <iostream>
#include "Dice.h"
#include "Prof.h"
using namespace std;
int main()
{
// declaration section
int int_variable;
float float_variable;
double double_variable;
Dice myDie(6);
// see how many bytes are used by this compiler for
// various data types
cout << endl;
cout << "int_variable requires: "
<< sizeof(int_variable) << " bytes" << endl;
cout << "(is that the same as sizeof(int)?: "
<< sizeof(int) << ")" << endl;
cout << endl;
cout << "float_variable requires: "
<< sizeof(float_variable) << " bytes" << endl;
cout << "(is that the same as sizeof(float)?: "
<< sizeof(float) << ")" << endl;
cout << endl;
cout << "sizeof(double) is: " << sizeof(double)
<< " bytes" << endl;
cout << "sizeof(char) is: " << sizeof(char)
<< " bytes" << endl;
cout << "sizeof(long int) is: " << sizeof(long int)
<< " bytes" << endl;
cout << "sizeof(short int) is: " << sizeof(short int)
<< " bytes" << endl;
cout << endl;
// how much space for an an object...?
cout << "sizeof(myDie) is: " << sizeof(myDie)
<< " bytes" << endl;
cout << "sizeof(Prof) is: " << sizeof(Prof)
<< " bytes" << endl;
// can sizeof() be used with a constant? yes!
cout << "sizeof(3) --- is that legal?: "
<< sizeof(3) << " bytes" << endl;
cout << endl;
// do expressions have a size...?
float_variable = 8.2;
cout << "sizeof(float_variable + float_variable): ";
cout << sizeof(float_variable + float_variable)
<< " bytes" << endl;
cout << endl;
return 0;
}