home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_11_07 / 1107105b < prev    next >
Text File  |  1993-04-29  |  528b  |  24 lines

  1. // base2.cpp:    Shows the bases of integers
  2. //               (Uses manipulators)
  3. #include <iostreams.h>
  4.  
  5. main()
  6. {
  7.     int x, y, z;
  8.     
  9.     cout << "Enter three ints: ";
  10.     cin >> x >> y >> z;
  11.     cout << x << ',' << y << ',' << z << endl;
  12.  
  13.     // Print in different bases
  14.     cout << dec << x << ',' << oct << y << ','
  15.          << hex << z << endl;
  16.  
  17.     // Show the base prefix
  18.     cout.setf(ios::showbase);
  19.     cout << dec << x << ',' << oct << y << ','
  20.          << hex << z << endl;
  21.     return 0;
  22. }
  23.  
  24.