home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Ebooks / Thinking in C++ V2 / C03 / Specify.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-25  |  1.0 KB  |  40 lines

  1. //: C03:Specify.cpp
  2. // From Thinking in C++, 2nd Edition
  3. // Available at http://www.BruceEckel.com
  4. // (c) Bruce Eckel 1999
  5. // Copyright notice in Copyright.txt
  6. // Demonstrates the use of specifiers
  7. #include <iostream>
  8. using namespace std;
  9.  
  10. int main() {
  11.   char c;
  12.   unsigned char cu;
  13.   int i;
  14.   unsigned int iu;
  15.   short int is;
  16.   short iis; // Same as short int
  17.   unsigned short int isu;
  18.   unsigned short iisu;
  19.   long int il;
  20.   long iil;  // Same as long int
  21.   unsigned long int ilu;
  22.   unsigned long iilu;
  23.   float f;
  24.   double d;
  25.   long double ld;
  26.   cout 
  27.     << "\n char= " << sizeof(c)
  28.     << "\n unsigned char = " << sizeof(cu)
  29.     << "\n int = " << sizeof(i)
  30.     << "\n unsigned int = " << sizeof(iu)
  31.     << "\n short = " << sizeof(is)
  32.     << "\n unsigned short = " << sizeof(isu)
  33.     << "\n long = " << sizeof(il) 
  34.     << "\n unsigned long = " << sizeof(ilu)
  35.     << "\n float = " << sizeof(f)
  36.     << "\n double = " << sizeof(d)
  37.     << "\n long double = " << sizeof(ld) 
  38.     << endl;
  39. } ///:~
  40.