8.9 Quick Start Project Design

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.