C语言只能识别3种字符,请有空闲的人看看,为什么6个scanf 只能输入3个字符。...

这段代码实现了一个简单的猜明星游戏,根据用户输入判断所想的明星。游戏通过一系列条件改变数组值,最后将数组值映射为对应明星名字。用户在每个阶段都有机会确认是否猜到心仪明星。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

#include "stdio.h"

show_name(int a);

main()

{

int i,j,k,flag=0;

static char a,b,c,d,e,f;

static int haha[65],hello[33];

for(i=1;i<65;i++)

haha[i]=i;//赋值完成

for(j=1;j<33;j++)

hello[j]=2*j-1;

for(j=1;j<33;j++)

{

show_name(hello[j]);

printf("\t");

if(j%4==0&&j>0)

printf("\n\n");

}

printf("有你想好的那个人吗?是输入(Y/y),其他输入表示没有\n");

scanf("%c",&a);

if(a=='Y'||a=='y')

flag=flag+1;//

for(j=1;j<33;j++)

{

if(j%2)

hello[j]=2*j;

else

hello[j]=hello[j-1]+1;

}

for(j=1;j<33;j++)

{

//printf("%d",hello[j]);

show_name(hello[j]);

printf("\t");

if(j%4==0&&j>0)

printf("\n\n");

}

printf("有你想好的那个人吗?是输入(Y/y),其他输入表示没有\n");

scanf("%c",&a);

if(a=='Y'||a=='y')

flag+=2;//

for(j=1;j<33;j++)

{

if(j%4==1)

hello[j]=2*j+2;

else

hello[j]=hello[j-1]+1;

}

for(j=1;j<33;j++)

{

//printf("%d",hello[j]);

show_name(hello[j]);

printf("\t");

if(j%4==0&&j>0)

printf("\n\n");

}

printf("有你想好的那个人吗?是输入(Y/y),其他输入表示没有\n");

scanf("%c",&c);

if(c=='Y'||c=='y')

flag+=4;//

for(j=1;j<33;j++)

{

if(j%8==1)

hello[j]=2*j+6;

else

hello[j]=hello[j-1]+1;

}

for(j=1;j<33;j++)

{

//printf("%d",hello[j]);

show_name(hello[j]);

printf("\t");

if(j%4==0&&j>0)

printf("\n\n");

}

printf("有你想好的那个人吗?是输入(Y/y),其他输入表示没有\n");

scanf("%c",&d);

if(d=='Y'||d=='y')

flag+=8;//

for(j=1;j<33;j++)

{

if(j%16==1)

hello[j]=2*j+14;

else

hello[j]=hello[j-1]+1;

}

for(j=1;j<33;j++)

{

//printf("%d",hello[j]);

show_name(hello[j]);

printf("\t");

if(j%4==0&&j>0)

printf("\n\n");

}

printf("有你想好的那个人吗?是输入(Y/y),其他输入表示没有\n");

scanf("%c",&e);

if(e=='Y'||e=='y')

flag+=16;//

for(j=1;j<33;j++)

{

hello[j]=31+j;

}

for(j=1;j<33;j++)

{

//printf("%d",hello[j]);

show_name(hello[j]);

printf("\t");

if(j%4==0&&j>0)

printf("\n\n");

}

printf("有你想好的那个人吗?是输入(Y/y),其他输入表示没有\n");

scanf("%c",&f);

if((f=='Y')||(f=='y'))

flag+=32;//

printf("如果不出意外,你想到的明星应该是:\n");

show_name(flag);

printf("\n");

}

show_name(int a)

{

switch(a)

{

case 1: printf("柳岩\t");break;

case 2: printf("杨幂\t");break;

case 3: printf("刘诗诗\t");break;

case 4: printf("林心如\t");break;

case 5: printf("曹颖\t");break;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值