C++ program design

1, & symbols as reference effect
For the definition of references can be classified into types and symbols of the use, is the use of symbols marked on the symbol types: symbol square reference name name = code; for example: printc; if&chart=if; marking out different definition, if is the symbol of the reference, which is also called the name change. Symbolic analysis diagram as shown in (Figure 1). Here must be the following instructions: there & symbols in the labels only to indicate the names of the form, not as any meaning; & symbols in the reference process, to change the role to the code change initial not, nor promote code changes of any kind; in reference to the process, for using the & symbol reference reference before and after the two names are the same in effect, that is to say the name is only a code, in the procedure in use is to distinguish between code change standard, renamed it can no longer be code; any change code renaming is not defined, so it will not code properties in the database is updated, only appeared in the program running smoothly and program debugging process, using the & symbol of the new defined code can be included in the program of new databases among.
The use of the symbol 2, program design &
The C++ program & symbols appear situation is labeled as a reference, for will play a certain role function changes, although no change in the nature of the code, but the function definition or there will be a certain impact. The change of parameters of mathematical functions & symbols change, to an important role for the domain parameters. Changes of function in C language in value, among the most changes on the main function, but also the & symbol most, one of the key factors in the procedures used in the study. In the main function & symbols in use, we must first clarify the original prototype function, for the expression and significance of function to have a preliminary understanding, change the equation and can reasonable use program, for function parameters in main & symbols also have different requirements of standard. In the main editor function, agent is expressed in the meaning of function parameters, & symbols are expressed as change of address of the function, at the same time the & symbol also express a number of function parameters, the parameters of the guiding function of parameters for the agent value analysis, statistics & symbols can get instant array information function the relevant array. In the operating system, configuration function & symbols, function change completely depends on the operating system, for the initial change in the value of the function operation have strict requirements, and zero processing function in the initial stages of the operation, in the late of each of the different function transform module, extract the data of different parameters numerical value, to guide the effective operation of the state of the computer program. By changing the symbol approach can definitely improve the program efficiency. See from the above example, pass by reference and pass a pointer in the function of the effect is the same. Thus, the called function in parameter is actually the argument or the target variable in the calling function's alias, so called function in all of the parameter operation is actually on the target variables in the calling function corresponding to the operation, the general transfer data more frequently, with higher efficiency reference program. Although the use of pointer address can also achieve the same effect, but because in the regulated but also to the parameter distribution storage unit function, and must use the variables in the argument of the calling function's address, this way will lead to poor reading program, and the use of reference appears to be simple and easy to understand, and the program structure is more clear. Often quoted statement: const type identifier & reference name = target variable name; in this reference, since the target variable value cannot be modified indirectly modified by reference, thus can well protect the target values of variables, making references have good security, that variable is equal to the target for const type. When the parameters need to be defined as a reference type is allowed, if the actual needs as much as possible the definition of const, it can guarantee the robustness of code, can also bring other benefits. In the process of function defined in code variable index in the initial definition, on the changes of the values of the variables were recorded, the code pointer variable pointing to initialize the pointer variable target variables. Normally provisions, the concrete operation process, a pointer to the actual operation of the code is the indirect operating point to variables. Using a pointer to the program design process can make the readability of the system procedures to reduce, it is relatively difficult in operation. And because the reference itself is the target variable alias, the programming of the reference operation is the direct operation of target variables. Reference is also a pointer, only its mode of operation is not the same with the pointer, pointer can be one to many mapping, while reference is only a pair of, is also a corresponding numerical parameters of a code pointer, namely digital not & symbols are changed, so in the symbol's use in view of reference, more easily than pointer manipulation and editing.
3, conclusion
C++ process due to the different programming requirements, specific meaning will demonstrate different, some program code is different by nature to change, change some code there is change in different symbols, the symbol's importance in our article detailed introduction, also by way of example of symbol the role and the programming language for symbol detection
W ELCOME TO THE F IFTH EDITION OF C++ Programming: From Problem Analysis to Program Design. Designed for a first Computer Science (CS1) C++ course, this text provides a breath of fresh air to you and your students. The CS1 course serves as the cornerstone of the Computer Science curriculum. My primary goal is to motivate and excite all CS1 students, regardless of their level. Motivation breeds excitement for learning. Motivation and excitement are critical factors that lead to the success of the programming student. This text is a culmination and development of my classroom notes throughout more than fifty semesters of teaching successful programming to Computer Science students. C++ Programming: From Problem Analysis to Program Design started as a collection of brief examples, exercises, and lengthy programming examples to supplement the books that were in use at our university. It soon turned into a collection large enough to develop into a text. The approach taken in this book is, in fact, driven by the students’ demand for clarity and readability. The material was written and rewritten until the students felt comfortable with it. Most of the examples in this book resulted from student interaction in the classroom. As with any profession, practice is essential. Cooking students practice their recipes. Budding violinists practice their scales. New programmers must practice solving problems and writing code. This is not a C++ cookbook. We do not simply list the C++ syntax followed by an example; we dissect the ‘‘why’’ behind all the concepts. The crucial question of ‘‘why?’’ is answered for every topic when first introduced. This technique offers a bridge to learning C++. Students must understand the ‘‘why?’’ in order to be motivated to learn. Traditionally, a C++ programming neophyte needed a working knowledge of another programming language. This book assumes no prior programming experience. However, some adequate mathematics background, such as college algebra, is required.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值