/* DemoDatatypes1.cpp CIS 150 5/26/2005 David Klick This program shows the range of the integer data types. The output will differ depending on what compiler is used. */ #include using std::cout; using std::endl; int main(void) { short n1 = 32765; int n2 = 2147483646; long n3 = 2147483646; cout << "A short is " << sizeof(short) << " bytes long\n"; cout << "An int is " << sizeof(int) << " bytes long\n"; cout << "A long is " << sizeof(long) << " bytes long\n"; cout << n1++ << ", " << n2++ << ", " << n3++ << endl; cout << n1++ << ", " << n2++ << ", " << n3++ << endl; cout << n1++ << ", " << n2++ << ", " << n3++ << endl; cout << n1++ << ", " << n2++ << ", " << n3++ << endl; return 0; } /* Sample output: A short is 2 bytes long An int is 4 bytes long A long is 4 bytes long 32765, 2147483646, 2147483646 32766, 2147483647, 2147483647 32767, -2147483648, -2147483648 -32768, -2147483647, -2147483647 */