电话号码对应英语单词

#include 
#include 

char *p[10] = {"","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};//把所有字符串列出来
int total[10] = {0,0,3,3,3,3,3,4,3,4};//每个数字对应的字符串的位数

int main()
{
	char buff[20];
	int i;
	while(scanf("%s",buff)!=EOF)
	{
		int len = strlen(buff);
		int *number = new int[len];//number存储输入的数字
		for(i=0;i=0)
			{
				if(answer[k] < total[number[k]] - 1)
				{
					answer[k]++;
					break;
				}
				else
				{
					answer[k] = 0;
					k--;
				}
			}
			if(k<0)
				break;
		}
		printf("\n");
	}
	return 0;
}
电话号码对应英语单词_第1张图片

你可能感兴趣的:(编程之美)