Unfinished (about encoding characters)

phonetic alphabet

In many software, you can quickly locate a certain entry by entering the initials of Pinyin. For example, in railway ticketing software, input: "bj" to locate "Beijing". How to implement this function in your own software? The crux of the problem is: For each Chinese character, it must be able to calculate its pinyin initials.
In the GB2312 Chinese character encoding method, the 3755 first-level Chinese characters are arranged in the order of pinyin. We can use this feature to find the first letter of pinyin for commonly used Chinese characters.
The GB2312 encoding scheme uses two bytes to represent each Chinese character. The first byte is the area number, and the second byte is the offset number in the area. In order to be compatible with the existing ASCII code (mixed Chinese and Western), the area code and offset number start from 0xA1.
As long as we find the first Chinese character of GB2312 code corresponding to each letter of Pinyin a,b,c,...x,y,z, we can locate the first letter of Pinyin of all first-level Chinese characters (regardless of polyphonic characters condition). The table below provides the preceding information. Please use this table to write a program to find out the pinyin initials of commonly used Chinese characters.
a Ah B0A1
b Bar B0C5
c Wipe B2C1
d Take B4EE
e Mo B6EA
f Fa B7A2
g Kar B8C1
h Ha B9FE
j Hit BBF7
k Ka BFA6
l Garbage C0AC
m Mom C2E8
n Take C4C3
o Oh C5B6
p Pop C5BE
q Phase C6DA
r Ran C8BB
s sprinkle C8F6
t collapse CBFA
w dig CDDA
x Xi CEF4
y press D1B9
z turn D4D1
[input and output format requirements]
The user first inputs an integer n (n<100), indicating that there will be n lines of text next. Then enter n lines of Chinese strings (each string does not exceed 50 Chinese characters).
The program outputs n lines, and the content of each line is the pinyin initials of the corresponding line input by the user.
Leave no spaces between letters, use all capital letters.
For example:
User input:
3
Everyone loves science
Beijing Tiananmen Square
Software Competition
and program output:
DJAKX
BJTAMGC
RJDS
[Note]
Please debug carefully! Your program will only get a chance to score if it runs correctly!
The input data used in marking the paper may be different from the example data given in the test paper.
Please write all functions in the same file, and after debugging, copy them to "Answer.txt" of the corresponding question number under the [Examinee Folder].
Do not copy in relevant project files.
Source code cannot use APIs such as drawing, Win32API, interrupt calls, hardware manipulation or operating system related APIs.
STL class libraries are allowed, but non-ANSI C++ standard class libraries such as MFC or ATL cannot be used.

For example, you cannot use the CString type (belonging to the MFC class library), and you cannot use the randomize, random functions (not belonging to the ANSI C++ standard)


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325756242&siteId=291194637