#include #include #include template void zeile(char const* typname, T x) { std::cout << setw(20) << typname << setw(4) << sizeof(x) << setw(15) << numeric_limits::min() << " ..." << setw(15) << numeric_limits::max() << setw(15) << x << '\n'; } enum Wochentag { SO, MO, DI, MI, DO, FR, SA}; typedef signed char BYTE; int main() { std::cout << "Grunddatentypen in C++\n" "Typ | Byte | Wertebereich von ... bis | Beispiel\n" "-------------------------------------------------------------------------"; bool b = true; char c = 'A'; short int s = c; int i = 65; long int l = 1234567890L; unsigned short int us = s; unsigned int ui = s; unsigned long int ul = s; Wochentag w = SA; float f = 2.71828f; double d = 3.1415; std::cout << "\nWahrheitswerte\n"; zeile("bool", b); std::cout << "\nZeichen\n"; zeile("char", (unsigned char) c ); std::cout << "\nGanzzahlen\n" " - mit Vorzeichen\n" ; zeile("short int", s); zeile("int", i); zeile("long int", l); std::cout << " - ohne Vorzeichen\n"; zeile("unsigned short int", us); zeile("unsigned int", ui); zeile("unsigned long int", ul); std::cout << "\nGleitkommazahlen\n"; zeile("float", f); zeile("double", d); }