#include <stdio.h> #include <stdlib.h> #include <time.h> #include <windows.h> void guitu(void); main() { 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!!! \n"); break ; } if(cou==70) { printf("tui win!!! \n"); break ; } Sleep(1); } printf("2013914203"); printf("\n"); }总结:编程序时思维要跟上,敲键盘速度也要跟上。。。
![]()
![]()
共2条
1/1 1 跳转至页
C语言程序设计--龟兔赛跑

关键词: 龟兔赛跑 printfun count

共2条
1/1 1 跳转至页
回复
有奖活动 | |
---|---|
【EEPW电子工程师创研计划】技术变现通道已开启~ | |
发原创文章 【每月瓜分千元赏金 凭实力攒钱买好礼~】 | |
【EEPW在线】E起听工程师的声音! | |
“我踩过的那些坑”主题活动——第001期 | |
高校联络员开始招募啦!有惊喜!! | |
【工程师专属福利】每天30秒,积分轻松拿!EEPW宠粉打卡计划启动! | |
送您一块开发板,2025年“我要开发板活动”又开始了! | |
打赏了!打赏了!打赏了! |
打赏帖 | |
---|---|
多组DCTODC电源方案被打赏50分 | |
【我踩过的那些坑】STM32cubeMX软件的使用过程中的“坑”被打赏50分 | |
新手必看!C语言精华知识:表驱动法被打赏50分 | |
【我踩过的那些坑】杜绑线问题被打赏50分 | |
【我踩过的那些坑】STM32的硬件通讯调试过程的“坑”被打赏50分 | |
【我踩过的那些坑】晶振使用的问题被打赏100分 | |
【我踩过的那些坑】电感选型错误导致的处理器连接不上被打赏50分 | |
【我踩过的那些坑】工作那些年踩过的记忆深刻的坑被打赏10分 | |
【我踩过的那些坑】DRC使用位置错误导致的问题被打赏100分 | |
我踩过的那些坑之混合OTL功放与落地音箱被打赏50分 |