c++运行闪退

在文件头部加上#include<stdlib.h>

main函数结尾处(如果有return的话,在return之前)加上system("pause");

示例

#include<cstdio>
//1
#include<cstdlib>
int main() {
	char c1, c2, c3;
	c1 = getchar();
	getchar();
	c2 = getchar();
	c3 = getchar();
	putchar(c1);
	putchar(c2);
	putchar(c3);
	//2
        system("pause");
	return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_41278720/article/details/80273805