标签:c语言
编程题:输入英文月份单词,输出对应月的数字形式。
#include<stdio.h>
#include<string.h>
int search(char list[][20],char name[],int m)
{ int i;
for(i=0;i<m;i++)
if(strcmp(list[i],name)==0) break;
return i;
}
void main()
{ char month_list[12][20]={"January","February","March","April","May","June","July",
"August","September","October","November","December"},month[20];int n;
gets(month); n=search(month_list,month,12);
if(n<12) printf("%s表示%d月\n",month,n+1);
else printf("查无此单词\n");
}
本文出自 “努力奋斗,互相提高” 博客,请务必保留此出处http://c10086.blog.51cto.com/6433044/1413799
编程题:输入英文月份单词,输出对应月的数字形式。,布布扣,bubuko.com
标签:c语言
原文地址:http://c10086.blog.51cto.com/6433044/1413799