为什么按了回车就闪退了呢
mingw吧
全部回复
仅看楼主
level 3
迷你肥皂 楼主
小白一个,为什么输入数字之后就闪退了呢,什么也没有提示
2018年08月01日 03点08分 1
level 3
迷你肥皂 楼主
#include <stdio.h>
main()
{
int a,b,c;
printf("Please input the number a:");
scanf("%d" , &a);
printf("Please input the number b:");
scanf("%d" , &b);
c=a+b;
printf("这两个数的和是:\n%d+%d=%d",a,b,c);
getchar();
return 0;
}
代码在这
2018年08月01日 03点08分 2
level 13
getchar();是吃掉一个字符而不是暂停,但常当作暂停用,但由于经常会吃掉上一次输入的回车而不能达到想要的作用.所以楼上的fflush(stdin);就有用了
或者inculde<windows.h>然后使用system("pause");来暂停
本吧事实上是c语言吧下载点,建议这种问题去c语言吧, 那儿人多回答的也快点
2018年10月27日 02点10分 3
fflush(stdin); 这个真的帮了我的大忙了!小白写了三个数排序,结果怎么怎么一直消失,加了这行代码果然好使了。
2018年10月29日 10点10分
level 4
安装MinGW过程中老是弹出这个图,是什么问题呐?谢谢
2018年10月28日 11点10分 4
1