Konsole schließt nach Debugging



  • Hallo,

    vorweg ich bin blutiger Anfänger was C++ betrifft und nun sitzte ich hier vor Visual C++ 2008 (Einsteigerversion).

    Habe ein neues Projekt eröffnet als WIN32 Konsolenanwendung und leeres Projekt und habe ein Element (.cpp) hinzugefügt und folgenden Code (ab)geschrieben (halt zum testen der Ausgaben usw :D):

    #include<iostream>
    #include<conio.h>
    using namespace std;
    
    int main() {
    
    	const float Pi = 3.141598;
    	int a = -6543, c = 12345;
    	unsigned int b = 123;
    	char i = 'i', k = 'k', htab = '\t';
    	char zeile[20]	= "Was ist das ?";
    	char *text		= "Das ist eine Überraschung !";
    	char *pz = zeile, *pt = text;
    	float x = 1.5, y = 37.7812, z = 2000.0;
    	float *px = &x, *py = &y, *pZ = &z;
    	struct KUNDE {
    		int nr;
    		char name[15];
    		float umsatz;
    	}; // ende struct
    
    	KUNDE ein_kunde = { 4711, "Werner Finck", 4.25};
    	float xx[3] = {1.5, 5.1, 7.3};
    
    	cout << 47;
    	cout << 11;
    	cout << 69;
    	cout << endl;
    	cout << 47 << 11 << 69;
    	cout << a << b << c;
    	cout << "a = " << a << endl << "b = " << b; 
    }
    

    Wenn ich das ganze kompliere und dann debugge wird das DOS-Fenster sofort geschlossen 😞

    Wie verhinder ich das? Gibt es da ein speziellen Befehl oder ist das den IDE Einstellung.

    Danke Vorab und Gruß der Cruz 😃



  • fflush(stdin);
    cin.get();
    

    vorm ende der main-funktion. 🙂



  • DANKE!!! 👍



  • sothis_ schrieb:

    fflush(stdin);
    cin.get();
    

    vorm ende der main-funktion. 🙂

    Gruselig.


Anmelden zum Antworten