The solution to this problem is to include either of the following statements at the end of your C/C++ code.
getch(); (Press any key to exit)
or
getchar(); (Press Enter to exit)
or
getc(stdin); (Press Enter to exit)
or
fgetc(stdin); (Press Enter to exit)
or
#include <stdlib.h>
system("pause"); (Not recommended)
Example
#include <stdio.h>
{
printf("Hello, World");
getchar();
}
Online C/C++ compiler: http://www.techbugs.org/wiki/OnlineCompiler
No comments:
Post a Comment