帮我优化一下 加个颜色 啊 会有很多版本啊 这是作业
C++有个简单的课程设计是打字游戏
答案:1 悬赏:30 手机版
解决时间 2021-02-07 18:20
- 提问者网友:我是我
- 2021-02-07 12:24
#include #include #include using namespace std;int main(){ cout<<"打字游戏"<>go; if(go==1) { clock_t start,finish; char s[100]={"how are you"}; cout< return 0;}
帮我优化一下 加个颜色 啊 会有很多版本啊 这是作业
帮我优化一下 加个颜色 啊 会有很多版本啊 这是作业
最佳答案
- 五星知识达人网友:爱难随人意
- 2021-02-07 12:30
#include
#include
#include
using namespace std;
int main()
{
cout<<"打字游戏"<
cout<<"按1开始游戏,按0结束游戏"<
int go;
cin>>go;
if(go==1)
{
clock_t start,finish;
system("color 3");
char s[100]={"how are you"};
cout<
start=clock();//游戏开始时间
char ch;
int i=0;
while(i<11)
{
ch=getch();
if(ch==s[i])
{
cout<
system("color 4");
i++;
}
else
{
cout<<'\a';//响铃提示输入错误
}
}
finish=clock();//游戏结束时间
cout<
int time=finish-start;
system("color 5");
cout<<"游戏结束"<
cout<<"用时"<
}
else
if(go==0)
{
cout<<"谢谢"<
}
return 0;
}
#include
#include
using namespace std;
int main()
{
cout<<"打字游戏"<
cin>>go;
if(go==1)
{
clock_t start,finish;
system("color 3");
char s[100]={"how are you"};
cout<
char ch;
int i=0;
while(i<11)
{
ch=getch();
if(ch==s[i])
{
cout<
i++;
}
else
{
cout<<'\a';//响铃提示输入错误
}
}
finish=clock();//游戏结束时间
cout<
system("color 5");
cout<<"游戏结束"<
else
if(go==0)
{
cout<<"谢谢"<
return 0;
}
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯