Xiao Ming's troublesTime limit: Ms | Memory limit: 65535 KB Difficulty: 1 description Xiao Ming recently received a tricky task, their company has a phone book. But this is a strange phone book, because it does not use numbers to record phone numbers, but instead uses the letters corresponding to the number keys to record phone numbers (2-abc,3-def,4-ghi , 5-JKL,6-MNO,7-PQRS,8-TUV,9-WXYZ), the phone number is only 11 digits. Now your task is to help Xiaoming to write a program to convert these letters to digital phone numbers. Enter the first line to enter a positive integer T (0<t<=100) that represents the number of groups of test data
Each set of test data has only one row, enter a string of characters (character length is 11), output each set of output is a row, the output number of the phone number sample input
3
phqghumeayl
Nlfdxfircvs
cxggbwkfnqd
Sample output
74744863295
65339347287
29442953673
Idea: Actually this question and 198 questions are the same, directly constructs an array to access the array element is good
#include <stdio.h>
int main ()
{
int N;
Char table[] = "22233344455566677778889999";
scanf ("%d", &n);
while (n--)
{
char s[12];
int i;
scanf ("%s", s);
for (i=0; s[i]! = ' + '; i++)
{
printf ("%c", table[s[i]-' a ']);
}
printf ("\ n");}
}