People often give others their telephone number as a word representing the seven-digit number. For example, if my telephone number were 866-2665,1 could tell people my number is "TOOCOOL," instead of the hard-to-remember seven-digit number. Note that many other possibilities (most of which an) nonsensical) can rep-resent 866-2665. You can see how letters correspond to numbers on a telephone key-pad.
Write a routine that takes a seven-digit telephone number and prints out all of the passible "words" or combinations of letters that can represent the given number. Because the 0 and 1 keys have no letters on them, you should change only the digits 2-9 to letters. You'll be passed an array of seven integers, with each element being one digit in the number. You may assume that only valid phone numbers will be passed to your routine. You can use the helper routine char getCharKeyl zr.: zelephoneKey, int place ) which takes a telephone key (0-9) and a place of either 1, 2,3 and returns the charac-ter corresponding to the letter in that position on the specified key. For example, GetCharKey(3, 2) will return 'E' because the telephone key 3 has the letters "D [F" on it and 'E' is the second letter.
Name:
Anonymous2011-05-22 9:26
lol homework threads
First download a dictionary of words, and partition them into words of 1,2..7 letters, discarding all the words of 8 or more letters.
Name:
Anonymous2011-05-22 9:32
Being one of the smartest creatures in the universe, that would be quite a depressing outcome indeed.
When I look at the mirror in the morning, it really feels like this entire vast universe has been an utter and total waste if it has not managed to produce anything better than me.
void bt (int k)
{
int i;
st[k] = 0;
while (st[k] < sizes[digits[k-1]])
{
st[k]++;
if (k == 7)
{
for (i = 1; i <= 7; i++)
printf ("%c", GetCharKey (digits[i-1], st[i]));
puts ("");
}
else
bt (k+1);
}
}
int main (void)
{
unsigned int number;
int i = 0, temp;
scanf ("%u", &number);
//generates number array
while (number)
{
digits[i++] = number % 10;
number /= 10;
}
//reverses number array so the digits are in proper order
for (i = 0; i < 7/2; i++)
{
temp = digits[i];
digits[i] = digits[7-i-1];
digits[7-i-1] = temp;
}