今天先来玩个小游戏

来源:互联网 编辑:wan玩得好手游小编更新:2024-11-07 07:38:30 人气:

有一段代码:

#include

#include

void main()

{

char a,x;

static int b[255],c[255],i,k;

FILE *y;

for(i=0;i

b[i]=i;

y=fopen("C:Users吃瓜群众Desktop胡鹏宾-2018901231暑假文件kjv.txt","r");

if(y==NULL)

printf("打开文件出错!");

x=fgetc(y);

while(!feof(y))

{

for(i=0;i

{a=b[i];

if(x==a)

c[i]++;

}

x=fgetc(y);

}

for(i=0;i

if(c[i]!=0)

k++;

fclose(y);

for(i=0;i

if(c[i]!=0)

printf("字符%c的个数为%d ",b[i],c[i]);

printf("有%d种字符",k);




}

下面又是时间的转化

#include

void main()

{

int date,month,year,i,j;

char a[12][12]={"January","February","March","April",

"May","June","July","August","September","October","November","December"} ;

while(1)

{

printf("请输入日期如:(2019-7-8) ");

scanf("%d-%d-%d",&year,&month,&date);

if((date

{for(i=0;i

if(month==i+1)

switch(date)

{

case 1:case 11:case 21:case 31:

printf("%dst  ",date);

for (j=0;j

printf("%c",a[i][j]);

printf(",%d ",year);

break;

case 2:

printf("%dnd  ",date);

for (j=0;j

printf("%c",a[i][j]);

printf(",%d ",year);

break;

case 3:

printf("%drd  ",date);

for (j=0;j

printf("%c",a[i][j]);

printf(",%d ",year);

break;

default:

printf("%dth  ",date);

for (j=0;j

printf("%c",a[i][j]);

printf(",%d ",year);

}}

else 

printf("你输入有误,请重新输入 ");}


}


欢迎玩家到【wan玩得好手游】查看最新变态版手游攻略,只需要在百度输入【wan玩得好手游】就可以浏览最新上线送满vip的变态手游攻略了,更多有关BT手游的攻略和资讯,敬请关注玩得好手游!

更多...

热门推荐

更多...

相关文章