(Telephone word game Generator) Standard telephone keypads contain the digits 0
ID: 3763241 • Letter: #
Question
(Telephone word game Generator) Standard telephone keypads contain the digits 0 through 9. the number two through 9 each have three letters associated with them, as indicated by the following table
Digit Letters
2 ABC
3 DEF
4 GHI
5 JKL
6 MNO
7 PRS
8 TUV
9 WXY
many people find it difficult to memorize phone numbers, so they use the correspondent between digits and letterrs to develop seven-letter words that correspond to their phone numbers, for example, a person whose telephone number is 686-2377 might usethe correspondece indicated in the above table to develop the seven-letter word "NUMBERS."
bussineses frequently attempt to get telephone numbers that are easy for their client to remember. if a bussiness can advertise a simple word for its customers to dial, then no doubts the bussiness will receive few more calls.
each seven-letter word corresponds to exactly one seven -digit telephone number. the restaurant wishing to increase its take-home bussiness could surely do so with the number 825-3688 (i.e "TAKEOUT").
each seven -digit phone number corresponds to many separate seven-letter words. unfornately, most of these represent unrecognzable juxtapositions of letters. it's possible, however, that the owner of a baber shop would be pleased to know that the shop's telephone number, 424-7288 correspond to "HAIRCUT." A vetenerian with the phone number 738-2273 would be pleased to know that the number corresponds to "PETCARE."
write a program that, given a seven-digit number, writes to a sequential file every possible seven-letter word corresponding to that number. there are 2187 (3 to seventh power) such words. Avoid phone numbers with the digit 0 and 1.
write in C++
Explanation / Answer
#include "stdafx.h" #include #include #include using namespace std; int _tmain(int argc, _TCHAR* argv[]) { int phoneNumber; int digitOne, digitTwo, digitThree, digitFour, digitFive; int digitSix, digitSeven; char A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U; char V, W, X, Y, Z; cout 2) && (phoneNumber < 9999999)); return 0; }Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.