所以在linux下我大概可以結束while循環與這種類型的代碼,如果我用gcc編譯:如何在Windows中用Ctrl + D結束c程序?
#include <stdio.h>
int main()
{
int s;
while(scanf("d%",&s)!=EOF);
{
scanf("%d",&s);
}
return 0;
}
然而,這並不與Windows電腦和Im使用的編譯工作,是微軟的Visual Studio 12 。 有什麼建議麼?
任何錯誤的Alt + F4? (或者你在找什麼) –
'scanf'不返回'EOF',你正在考慮'getchar' ... – zwol
[Ctrl + D不能停止應用程序在命令窗口中執行]的可能重複(http ://stackoverflow.com/questions/12001894/ctrld-not-stopping-application-from-executing-in-command-window) –