+ 1

Debugging Problem C++ with Visual Studio community

shouldn't after pressed debug will be pop out a window that shows our code result, like Hello World and etc...?? but in my laptop , after pressed debug , that log window pops out about 0.5 sec and disappear , how do i solve this problem ? i wanna see the result that i'm coding ...

20th Apr 2017, 3:52 AM
John Goh (KH)
3 Réponses
+ 3
Use getchar() or system("pause") before your return statement. It's not really a "problem", it's just because the program terminates after executing. Edit: Like I said, you need to put it just before your return statement. You're not calling your pause macro anywhere, so it's not going to do anything. Using your macro, the body of main should look like cout << "Hallo World!"; WINPAUSE; return 0;
20th Apr 2017, 4:59 AM
Squidy
Squidy - avatar
+ 1
Control + f5
20th Apr 2017, 5:38 AM
aklex
aklex - avatar
0
#include <iostream> #include <stdlib.h> #ifdef _WIN32 #define WINPAUSE system("pause") #endif using namespace std; int main() { cout << "Hallo World!"; return 0; } above my codes, it's still closes after pressed debug , how do i set it right ?
20th Apr 2017, 4:05 AM
John Goh (KH)