#include<stdlib.h>
#include<time.h>
void guitu(void);
main()
{ printf("2013914116\n");
srand(time(NULL));
guitu();
return 0;
}
void guitu()
{
int j,count=0,cou=0,number;
char printfun[71];
while(1)
{
for(j=0;j<70;j++)
{
printfun[j]=' ';
printfun[70]='|';
}
number=rand()%10+1;
printf("\n");
if(number>=1&&number<=5)
{
count+=3;
if(count>70)
{
count=0;
}
printfun[count]='G';
}
if(number>=6&&number<=7)
{
count-=6;
if(count<0)
{
count=0;
}
printfun[count]='G';
}
if(number>=8&&number<=10)
{
count+=1;
if(count>70)
{
count=0;
}
printfun[count]='G';
}
if(number>=1&&number<=2)
{
cou+=0;
if(cou>70)
{
cou=0;
}
printfun[cou]='T';
}
if(number>=3&&number<=4)
{
cou+=9;
if(cou>70)
{
cou=0;
}
printfun[cou]='T';
}
if(cou==5)
{
cou-=12;
if(cou<0)
{
cou=0;
}
printfun[cou]='T';
}
if(number>6&&number<=8)
{
cou+=1;
if(cou<70)
{
cou=0;
}
printfun[cou]='T';
}
if(number>=9&&number<=10)
{
cou-=2;
if(cou<0)
{
cou=0;
}
printfun[cou]='T';
}
if(count==cou)
{
printfun[count]='P';
}
printf("%s\n",printfun);
printf("\n");
if(count==70)
{
printf("gui win!!!学号2013914116\n");
break;
}
if(cou==70)
{
printf("tui win!!!\n");
break;
}
}
}
敲了很久,错误一开始很多后来一个个改了,终于可以把程序读出来不过,图片格式不对,上传不了