1 #include<stdio.h> 2 char roma[12][5]= {"I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII"}; 3 char s[5]; 4 void seek(); 5 int check(char*); 6 int main() 7 { 8 int n=1; 9 while(gets(s)) 10 { 11 printf("Case %d: ",n++); 12 seek(); 13 } 14 } 15 16 void seek() 17 { 18 for(int i=0; i<12; ++i) 19 if(check(roma[i])) 20 { 21 printf("%d\n",i+1); 22 break; 23 } 24 return ; 25 } 26 27 int check(char a[]) 28 { 29 for(int i=0; s[i]!=‘\0‘; ++i) 30 if(s[i]!=a[i]) 31 return 0; 32 return 1; 33 }
原文:http://www.cnblogs.com/qq188380780/p/6361112.html