色哟哟视频在线观看-色哟哟视频在线-色哟哟欧美15最新在线-色哟哟免费在线观看-国产l精品国产亚洲区在线观看-国产l精品国产亚洲区久久

您好,歡迎來電子發燒友網! ,新用戶?[免費注冊]

您的位置:電子發燒友網>源碼下載>數值算法/人工智能>

人機猜數游戲源代碼

大小:155 人氣: 2010-02-09 需要積分:0
{$username}的空間

用戶級別:注冊會員

貢獻文章:

貢獻資料:

人機猜數游戲源代碼
#include "time.h"
#include "stdlib.h"
#include
#include
void guess1( )
{
?int Password=0,Number=0,price=58,i=0;
?clrscr();
?printf("\n====This is a Number Guess Game!====\n");
?while( Password != 1234 )
?{
??if( i >= 3 )
???return;
??i++;
??puts("Please input Password: ");
??scanf("%d",&Password);
?}
?
?i=0;
?while( Number!=price )
?{
??do{
???puts("Please input a number between 1 and 100: ");
???scanf("%d",&Number);
???printf("Your input number is %d\n",Number);
??}while( !(Number>=1 && Number<=100) );
??if( Number >= 90 )
??{
???printf("Too Bigger! Press any key to try again!\n");
??}
??else if( Number >= 70 && Number < 90 )
??{
???printf("Bigger!\n");
??}
??else if( Number >= 1 && Number <= 30 )
??{
???printf("Too Small! Press any key to try again!\n");
??}
??else if( Number > 30 && Number <= 50 )
??{
???printf("Small! Press any key to try again!\n");
??}
??else
??{
???if( Number == price )
???{
????printf("OK! You are right! Bye Bye!\n");
???}
???else if( Number < price )
???{
????printf("Sorry,Only a little smaller! Press any key to try again!\n");
?
???}
???else if( Number > price )
????printf(" Sorry, Only a little bigger! Press any key to try again!\n");
??}
??getch();
?}
}
?
void? guess2( )
{ int y,stime,a,z,t,i,c,m,g,s,j=0,k=0,b[4],l[4];
? long ltime;
? ltime=time(NULL);
? stime=(unsigned int)ltime/2;
? srand(stime);
? z=random(9999);
? printf("I have a number with 4 digits in mind,please guess.\n");
? for(c=1;;c++)
? { printf("Enter a number with 4 digits:");
??? scanf("%d",&g);
??? a=z;j=0;k=0;
??? l[0]=l[1]=l[2]=l[3]=0;
??? for (i=1;i<5;i++)
??? { s=g;m=1;
????? for (t=1;t<5;t++)
????? { if (a%10==s%10)
?{ if (m&&t!=l[0]&&t!=l[1]&&t!=l[2]&&t!=l[3])
?? { j++;m=0;l[j-1]=t;
?? }
?? if (i==t)

?
void swap1(float *p1,float *p2)
{float temp;
?temp=*p1;*p1=*p2;*p2=temp;
}
void swap2(char **p1,char **p2)
{char *temp;
?temp=*p1;*p1=*p2;*p2=temp;
}
void sort(char *code[],char *name[],float *score1,float *score2,
float *score3,float *aver,int n)
{int i,j;
?for (i=0;i?? for (j=i+1;j???? if (aver[i]???? { swap1(aver+i,aver+j) ;
?????? swap1(score1+i,score1+j);
?????? swap1(score2+i,score2+j);
?????? swap1(score3+i,score3+j);
?????? swap2(&name[i],&name[j]);
?????? swap2(&code[i],&code[j]);
???? }
簡易計算器源代碼
#include
int operator1,operator,first,second,result;
displaycalculator()
{clrscr();
?printf("+-------------------\n");
?printf("| Simple Caculator |\n");
?printf("+-------------------\n");
?printf("|????????????????? |\n");
?printf("+----+----+----|----\n");
?printf("|??? |? / |? * | - |\n");
?printf("+----+----+----|----\n");
?printf("|? 7 |? 8 |? 9 |?? |\n");
?printf("+----+----+----| + |\n");
?printf("|? 4 |? 5 |? 6 |?? |\n");
?printf("+----+----+----|---|\n");
?printf("|? 1 |? 2 |? 3 |?? |\n");
?printf("+----+----+----| = |\n");
?printf("|? 0????? |? . |?? |\n");
?printf("+---------+----|---|\n");
}
getdata()
{int c,n=0;
?do
?{ c=getch();
?? if (c>='0' && c<='9')
?? { putch(c);
???? n=n*10+c-0x30;
?? }
?? if (c=='\b' && wherex()>2)
?? { putch(c);putch(0x20);putch(c);
???? n/=10;
?? }
?}while (!(c==27||c=='+'||c=='-'||c=='*'||c=='/'||c=='\n'));
?operator=c;
?if (c!=27&&c!='\n') putch(c);
?return (n);
}
calculate()
{ if (operaor1=='+')
?? result=first+second;
? else if (operaor1=='-')
?? result=first-second;
? else if (operaor1=='*')
?? result=first*second;
? else
?? result=first/second;
}
displayresult()
{ gotoxy(2,4);
? printf("???????????? ");
? gotoxy(2,4);
? printf("%d",result);
? if (operator!=13 && operator!=27) putch(operator);
}
main()
{ displaycalculator();
? gotoxy(2,4);
? first=getdata();
? while (operator!=27)
? { operator1=operator;
??? second=getdata();
??? displayresult();
??? first=result;
? }

非常好我支持^.^

(8) 100%

不好我反對

(0) 0%

      發表評論

      用戶評論
      評價:好評中評差評

      發表評論,獲取積分! 請遵守相關規定!

      ?
      主站蜘蛛池模板: 日本wwwhdsex69| 免费人成网站在线观看10分钟| 国产色无码精品视频国产| 国产乱人伦AV麻豆网| 国拍在线精品视频免费观看 | 永久免费精品影视网站| 在教室做啊好大用力| 99热这里只有精品88| 成人毛片大全| 国产三级在线观看视频| 九色PORNY真实丨首页| 明星三级电影| 善良的女房东味道2在线观看| 亚洲国产在线2o20| 尤物久久99国产综合精品| 99视频国产在线| 国产精品麻豆高潮刺激A片| 极品虎白在线观看| 男女生爽爽爽视频免费观看| 日日噜噜大屁股熟妇| 亚洲色偷偷偷网站色偷一区人人藻| 4k岛国精品午夜高清在线观看| www.色片| 黄色三级三级三级免费看| 男女又黄又刺激B片免费网站| 日本免费一本天堂在线| 亚洲精品久久久久AV无码林星阑| 97超碰射射射| 国产精品久久vr专区| 久久偷拍国2017| 色悠久久久久综合欧美99| 伊人久在线| 高清欧美videos sexo| 久久xxxx| 色噜噜狠狠色综合欧洲| 诱人的秘书BD在线观看| 成人 迅雷下载| 久久se精品一区二区国产| 日本熟妇多毛XXXXX视频| 亚洲伊人色| 成 人 网 站毛片|