C语言 为什么 getch() 在 Visual Studio 2008 中不起作用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16405936/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 06:16:05 来源:igfitidea点击:
Why getch() is not working in Visual Studio 2008?
提问by Lyrk
Below code works in DevC++ with MinGW works flawlessly but Visual Studio 2008 spits this:
下面的代码可以在 DevC++ 中使用 MinGW 完美运行,但 Visual Studio 2008 会吐槽:
error C3861: 'getch': identifier not found .
What can I do to accept getch() if this is not possible is there an alternative to getch() that I can use to pause the screen?
如果这是不可能的,我可以做些什么来接受 getch() 是否有替代 getch() 可以用来暂停屏幕?
Code:
代码:
#include <stdio.h>
#include <conio.h>
int main(void){
char str[] = "This is the end";
printf("%s\n", str);
getch(); //I tried getchar() also still does not work
return 0;
}
回答by BLUEPIXY
回答by Dev
You can use as well as
您可以使用以及
#include<iostream>
int main()
{
system("pause");
return 0;
}

