C ++ Getting Started (0) - Preface

zhaozj2021-02-11  191

sequence

0. Why study C 0.Why SHALL I LEARN C ?

C has attracted many programming learners as a relatively mature language. The proportion of C books in the programming books can be seen in the proportion of C books. Of course, with the rise of Java, C #, there are also some different sounds, and C is not efficiently applied and programmed, and the rapid development of hardware will also make the virtual platform's speed weakness, and its excellent The portability and safety will make it a new language mainstream ... but no matter how to say, C powerful and flexible language mechanism, profound connotation, extensive extension of Guangbo makes it a classic language of an era, which is reflected The beauty of programming thoughts makes it deep in-depth, and no matter whether it is too late tooth, it is a very worthwhile language. Although I think that the past, now I am still in the future. There is no language that does not have the language in the sky, it can be a master (the most important thing, "the" not XXX language is not true master ", but if you missed C in this era I still have a little regret, after all, you missed a shared classic opportunity (a little bit, there may be some subjective, huh, huh). As for practical, natural, C is not the only choice (Andrew Koenig has repeatedly emphasized the final benchmark of C design in "C Shen Shu", but many of us seem to prefer VB, Delphi when developing desktop applications Wait RAD). In general, we will allow a variety of options, but from the perspective of ideological deepening (learning aspect), C may give you quite a lot of inspiration, even if you actually develop RAD in other languages.

1. Positioning of this series 1.Position

This series is mainly "pure" beginners facing C , and their head contact C , even at the same time, I will walk into the world of Programming. Now there are many good books on the market, and the network is developed. Therefore, today's beginners have a blessing, unlike the original, find a C book is quite "can", where knows what is good, not good, book again Rotten, doubt is also your own brain (I am afraid even if the word "bad book" has not yet invented it). Nowadays, readers are not difficult to find a light convenience or detailed book to learn from their own situation. However, after all, the book itself should take into account the systematicization of the content organization, so inevitable, temporary or permanently exist of some readers to know how they do not appear, or there is slightly mentioned but not deep. If there is a teacher, it is naturally not a problem, but maybe more enthusiasts are like I "come over" (huh, I am experiencing the heart, I can't smash, how many people accurate. The purpose of this series is "itching", itch is uncomfortable, so solving some people who have nothing to do with it or even "mentally" problems, but I believe this is a lot of beginners very much. I really want to know But there is no thing from finding. What is "something" is not, it may judge some subjective, I have been searching for the curve you learn; at the same time, I also hope that my friends will contact me in the process of introducing myself (kusk@163.com), As for myself, it is also a beginner, but it is only a long time, it is slightly experienced, but the error may appear, and I also welcome the correct proposal: Your attention will be my biggest power ^ ^ 2. What is C 2.What IS C ?

There may now be many beginners unclear C , VC, MFC, C Builder these basic concepts, often heard that "VB is not enough strong, I will start learning VC tomorrow, some bookstores are still Mount "Visual C Language", "C Builder Language" classification card. In fact, C refers only to a computer language, which specifies the grammar of the document program, such as how to use variables, constants, how to write statements, how to make computers to make judgments, how to make certain functions repeatedly execute several times ( Loop), how to put some complex "package" into a simple module (function / subroutine) for call, and so on. It can be said that the language is independent of the computer, it is just a series of rules that are formulated. If you like, you can also take out a new language such as a D . However, if you have a rule, you can't write the program and put it into the run, you should let your computer learn to use your D language. Most of the current computers can only directly identify binary machine languages, so the usual practice is to write a program responsible for translation, which can automatically convert your input D program into binary, so that the computer can perform it. This procedure responsible for translation, usually we call the compiler. When there is a language popular, there will be some software vendors to notice: 噫, D seems to be very popular, we should immediately launch D compiler to occupy the market. So the various manufacturers have launched their own D compiler. For distinguishing, different manufacturers have different names, for example, may be "Visual D ", "D Builder", "Better D ", and more. Usually the most primitive compilation is a command line method. If I want to compile a hello.dpp source program, then I may have to enter the DOS command line method, if the compiler is DPP32, I need to type similar to DPP32 Hello.dpp Trouble about Hello.exe indicates it. If there are multiple source files, you have to update compilation, links, etc., you may pay more attention to many obscure parameters according to different needs, this will be very troublesome. If you have a little bit, you can write a file called Maikfile, which can store these settings and let the compiler identify yourself without having to type each time. But the back and back of the command line is still not fast enough, so smart compilers usually specifically designed a compilation platform called "Integrated Compilation Environment (IDE)": it can be seen as an additional convenience we use D The editing software of the function, for example, we can do not need to switch back to the command line mode, and simply click Compile icon or press the corresponding shortcut key, the compiler will automatically compile us, of course we can also The software is set in the software. In this long, this editing software also has some easy-to-use features. For example, it will smartly display the keywords in the D program to another color. The number is another color ... this is the advantage of this is We analyze the program, timely discover input error, and so on. The powerful compilation environment also integrates code analysis, tracking debugging, etc., more than the command line mode. But don't forget, really "create" out the procedure, or those the most original command line program.

In addition, due to the current operating system, it is often necessary to do many repetitions and useless labor if the current operating system is getting more and more complex. Therefore, each compiler usually provides a set of completed libraries in the compilation platform, and the collection of related modules for building programs is called application framework, and the common application frames under Windows have MFC, VCL, etc. Some cross-platform frames such as QT. The frame may be integrated in the compilation platform, or it can be released separately. Of course, the use of the frame is optional, and the MFC is attached in the VC, you can use it or not. 3. General steps of learning programming 3.how to Learn Progrmming Step by Step

Learning language to application programming, can be divided into three steps: 1. Learn language grammar, standard library, thinking; 2. Learn the API of the relevant operating system (application programming interface); 3. Learning class library. After some experience, the three can be alternate and deepen each other. Also learn some basic theories, like design patterns, algorithms, and data structures, etc.

Attachment: Several common concepts - answer neverdown1983 users ask: What is the difference between standard libraries and class libraries? Can the application programming interface (API) can explain? Thank you!

I want to talk about the library, I want to know this concept, I have a few words in the next sentence: the so-called library is a collection of program code: When programming, there will be many common functions, If each of the programs that use these functions is written from the header, it will appear unsemprecious labor; therefore, people have written these commonly used functions and organize them according to certain logical relationships, and they are directly called when they are programmed. I became a library. How is the program module in the library placed? Well, first of all, we will naturally think that the commonly used function is packaged into a corresponding function. When the program uses these functions, we call the corresponding function. The library of these functions can naturally be called a library, obviously the idea of ​​the library is the process of the process; secondly, we can also package the task to be implemented into a class (Class), such as the function of a library containing file operations. Designers may write a File class, which may have Open, Close, Reset, Read, Write and other methods, and may have some data structures for saving file information, and so on. These libraries consisting of various classes are called class libraries, which are object-oriented. Therefore, according to your organization, the library can be divided into a library, class library, etc. As for the standard library and non-standard libraries, it is another classification method. If a library is a C language standard, "specifies", such as STL (ie, the standard template library, the container and related algorics such as the Vector, List, the container, and related algorics, and related algorithms) are part of the language. Part of the standard library called C (standardized, regardless of VC, C Builder, what other C compilation platform, requires it to include "true" C ). Of course, the scope of the standard library is relatively narrow, in addition to this, such as MFC, VCL, Qt, etc., other software vendors (or organizations), are not written in the C standard (the book for the Single introduction C will not introduce them. ), Not part of the language, so it is not a standard library. Application Programming Interface is the functionality provided by the operating system as programmers. You have to write a program on an operating system, you have to rely on the operating system in one move: You have to read a file, or draw a point on the screen, eventually ask the operating system to be implemented for you, and these requirements. Or the way "dealing with the operating system" is through the programming interface. In DOS, the functionality to be implemented is ultimately "tell" operating system through an interrupted manner, so that it is done for you, so it can be said that the interrupt is the API of the DOS system; to a more complex Windows system, due to the interrupt Simple and low, so Windows provides programmers to provide a series of functions. These functions have been compiled, mostly placed in each of the .dll files that have been installed with the system, in most cases, compiler under Windows Turn our program with these function library links; naturally, they are called API functions. Windows's API function is thousands, complicated than more than ten dozens of interruptions in DOS districts, providing more and more complete services than DOS.

转载请注明原文地址:https://www.9cbs.com/read-5157.html

New Post(0)