C Language Project development process

Source: Internet
Author: User
Tags array length

I. Overall development of Project C as shown

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/1069003/201705/ 1069003-20170522200442007-1924401322.png "style=" border:0px; "/>

Two. Analysis of each step

1. Requirements Document Analysis, this example with an electronic dictionary as an example

List each requirement and every feature of each requirement, and summarize it into a single table.

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/1069003/201705/ 1069003-20170522202749210-2009142773.png "style=" border:0px; "/>

2. Design data structure

Design data structure, that is, to determine the type of abstract data, data storage methods, first think of multiple scenarios, and then compare the pros and cons of each scheme

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Border:none; "/>

 1 /* 2  Solution 1 3  uses three-dimensional arrays, 110000 is the number of words, 2 bits per word corresponds to 2 rows, and 100 indicates the number of characters each row can store, 4  Because the stack space is up to 1M, this is not possible and consumes CPU resources  5 word[i][2][100] represents a word and an explanation  6 */ 7 char word[ 110000][2][100];// 8 /* 9  scenario 210  uses a structure that represents a word, key stores words, trans storage 11  All words are stored in a dynamic array of malloc allocations, and because each word is different in length, the interpretation of each word is different,12  so the length of the key is too small to meet the demand, too large to create a waste of storage space 13 */14 struct  word{15     char key[100];//Word 16     char  trans[100];//words corresponding to the interpretation of 17 };18 /*19  scheme three 20  use struct, but the member is a pointer, according to the actual size of words and explanations allocated memory, memory footprint small 21  Cons: Explanations are not detailed enough because a word corresponds to multiple interpretations of the 22 */23 struct word{24     char *key;//word pointer , pointing to a malloc allocated memory 25     char *trans;//explanatory pointer 26 };27 /*28  scenario four 29  30 */31 struct word{32     char *key;//A word pointer using the struct body, Points to a malloc allocated memory 33     int count_trans;//Each word corresponds to the number of interpretations 34     char **trans;//the array of character pointers that hold the explanation 35 }; 

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Border:none; "/>

3. Draw the program overall flow chart according to demand

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/1069003/201705/ 1069003-20170522233926351-1230580987.png "style=" border:0px; "/>

4. Analyze the storage structure of the data type, such as

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/1069003/201705/ 1069003-20170523002932570-520695053.png "style=" border:0px; "/>

5. Defining Common variables

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Border:none; "/>

1/********* define common global Variables *****************/2/* 3 give a new name to the struct type: Word 4 */5 typedef struct WORD SWORD; 6/********* struct pointer, ******/7 SWORD * DICT, pointing to the thesaurus struct array; 8/*********** text Thesaurus file name *********************/9 char *dicttxtname = "Dict.txt"; 10/*********** binary thesaurus file name ***************** /11 char *dictbitname = "Dict.dat"; 12/************ number of thesaurus, struct array length ***************/13 int.

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Border:none; "/>


C Language Project development process

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.