Wednesday, December 17, 2014


Advanced OOP Programming 3rd Assignment

So this Assignment proved to be a little more difficult for me, although i ended up figuring it out. We were to use the different Data Types and find their ranges for ints, longs, shorts, and chars. Signed and Unsigned. We then were to print out to the console the MIN and MAX for signed and unsigned data types, the number of bits and bytes, and storage size. For a better explanation on what Signed and Unsigned means here is what Wikipedia has to say ...

"The actual size of integer types varies by implementation. The standard only requires size relations between the data types and minimum sizes for each data type:
The relation requirements are that the long long is not smaller than long, which is not smaller than int, which is not smaller than short. As char's size is always the minimum supported data type, all other data types can't be smaller.
The minimum size for char is 8 bits, the minimum size for short and int is 16 bits, for long it is 32 bits and long long must contain at least 64 bits.
The type int should be the integer type that the target processor is most efficient working with. This allows great flexibility: for example, all types can be 64-bit. However, several different integer width schemes (data models) are popular. This is because the data model defines how different programs communicate, a uniform data model is used within a given operating system application interface.[4]
In practice it should be noted that char is usually 8 bits in size and short is usually 16 bits in size (as are their unsigned counterparts). This holds true for platforms as diverse as 1990s SunOS 4 Unix, Microsoft MS-DOS, modern Linux, and Microchip MCC18 for embedded 8 bit PIC microcontrollers. POSIX requires char to be exactly 8 bits in size.
The actual size and behavior of floating-point types also vary by implementation. The only guarantee is that long double is not smaller than double, which is not smaller than float. Usually, the 32-bit and 64-bit IEEE 754 binary floating-point formats are used, if supported by hardware."

So now that you have a better understanding, here is a few pictures showing what my code looks like with of course the header file showing you how that is used.: