翻译电话号码

时间:2017-12-08 13:31:06
【文件属性】:

文件名称:翻译电话号码

文件大小:827B

文件格式:TXT

更新时间:2017-12-08 13:31:06

C 电话号码翻译

#include #include #include #define M 1000 int main() { int i,j,n=0,d,f; char *p[] = { "zero","noe", "two", "three", "four","five","six","seven","eight","nine","double" }; char q[M][9]; char c = '\0'; while (c !='\n') { scanf("%s%c", q[n], &c); n++; } for (i = 0; i < n; i++) { f = 0; for (j = 0; j < 11; j++) { if (!strcmp(q[i], *(q + j)) && (j <= 9)) { printf("%d", j); f = 1; if (d == 1) { printf("%d", j); d = 0; } break; } if (!strcmp(*(q + i), *(q + j)) &&(j == 10)) { if (d == 1) { f = 0; break; } else if (d == 0) { d = 1; f = 1; break; } } } if (f == 0) break; } if (f == 0 || d == 1) printf("error"); system("pause"); return 0; }


网友评论