01 // Typkonvertierung bei Ein- und Ausgabe
02 // Datei: tkein01.cpp
03
04 #include <iostream.h>
05
06 int main()
07 {
08 int x;
09 cin >> x;
10 cout << "\nGeben Sie eine Zahl ein: ";
11 if (cin) // Konvertierung auf void*,
12   cout << "Eingabe war: "<< x << endl;
13 else
14   cout << "\nFehlerhafte Eingabe\n" << endl;
15 return 0;
16 }
17

Bild 16-7  Statusabfrage mit Typkonvertierung