啊哈磊_编程从这里起步
标题:
为什么getch错误
[打印本页]
作者:
一只耳猴
时间:
2019-4-18 23:21
标题:
为什么getch错误
#include
#include
#include
int main()
{
char a[50][50]={"######",
"#O # ",
"# ## #",
"# # #",
"## #",
"######",
};
int x=1,y=1,p=1,q=5,i;
char ch;
for(i=0;i<=5;i++)
{
puts(a[i]);
}
ch=getch();
if(ch=='s')
{
if(a[x+1][y]!='#')
{
a[x][y]==' ';
x++;
a[x][y]=='O';
}
}
system("cls");
for(i=0;i<=5;i++)
{
puts(a[i]);
}
Sleep(5000);
return 0;
}
复制代码
作者:
帅小子
时间:
2019-4-19 17:39
因为c++根本就没有getch这个函数,只有getchar。
还有,为什么你没有写上头文件和using namespace std?
作者:
年糕gzy
时间:
2019-4-27 15:07
getch()包含在#include <conio.h>里,你可以试一下
欢迎光临 啊哈磊_编程从这里起步 (https://bbs.codeaha.com/)
Powered by Discuz! X3.2