Stage 1: Design struct
Struct word
{Char * key; // first test the word length, and then malloc int ntrans; // record the number of word interpretations char ** trans; // pointer array, each Pointer Points to an explanation };
Malloc: 0.11 million struct arrays the content of each word depends on the number of ntrans --> design a pointer Array
User input, comparison keyword key. Binary Search (sort the entire strcmp structure by key first) returns the subscript of the struct array to print the explanation.
Stage 2: optimize startup speedFwrite to the binary file, and then load the binary file by yourself.
Content to be written 1. The number of all words. In this way, we will know 0.11 million. Fgets/2 4b2. the length of the key is assumed to record 7 bytes 4B helloni \ 03. key Content 7b4. number of ntrans: 4b5. trans [0] length 11B AAAAA \ 0 7. the length of trans [1] is assumed to be 10 bytes 4B 6. trans [0] content 8. trans [1] content ........................................................................
Stage 3: User-Defined dictionarySearch for the file generated before, and find it in the file added by the user.
From Weizhi note (wiz)
8.9 Quick Start Project Design