int = char;
-
Hallo Leute,
wie bekomme ich den Wert time (char) in a (int) ?!
a soll spaeter mal hoch gezaehlt werden ++a.#include <iostream.h> int main() { char time[5] = "500"; int a; cout << time << endl; a = reinterpret_cast<int>(time); cout << a << endl; return(0); }
die ausgabe ist:
500
1245048
sollte aber:
500
500
sein.mfg Oliver Kern
-
-
#include <iostream> #include <conio.h> #include <cstdlib> using namespace std; int main() { char time[5] = "500"; int a; cout << time << endl; a = atoi(time); cout << a << endl; getch(); return(0); }
Das ergibt: 500 500
-
Vielen Dank geht.