用户:******查看:3 回复:3 评论:3 创建时间:2020-01-13T14:26:06
【作品展示】

【作品介绍】
无,作者太懒
【作品源代码】
//按"1"、"2"控制
#include"stdio.h"
#include"conio.h"
void delay(int x)
{int y
while(x--)
for(y=0
y & lt
125
y++)
{
}
}
void pout(int i)
{
if(i == 1)
{
printf("%c", 26)
delay(1000000)
printf("\b%c", 0)
}
if(i == 2)
{
printf("\b%c", 0)
printf("%c", 27)
delay(1000000)
printf("\b%c\b\b", 0)
}
}
int main()
{
int a = 1
while(1)
{
if(kbhit())
{
a = getch()-48
}
pout(a)
}
return 0
}
例二:猜一个1~到100的数
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std
int main()
{
srand(time(0))
// 生成随机数生成器种子
int theNumber = rand() % 100+1
// 1-100的随机数
int tries = 0, guess
cout & lt
& lt
"\tWecome to Guess My Number\n\n"
do
{
cout & lt
& lt
"Enter a guess:"
cin & gt
& gt
guess
+ +tries
if(guess & gt
theNumber)
cout & lt
& lt
"Too high!\n\n"
if(guess & lt
theNumber)
cout & lt
& lt
"Too low!\n\n"
}while(guess != theNumber)
cout & lt
& lt
"\nThat's it! You got it in " & lt
& lt
tries & lt
& lt
" guess!\n"
return 0
}
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn