About C ++ Preparation Knowledge

xiaoxiao2021-03-05  30

About C Obviously you already know the meaning of programming, then we have to do is to start learning C . So what is C , why we have to learn C . What is C C This word is usually read "C plus" in the programmer circle in mainland China, and the West's programmer usually reads "See Plus Plus". C is a computer programming language. She is a static data type check, a general programming language that supports multiple programming paradigm, is a very broad computer programming language that is used in the existing hundred computer languages. Dr. Bjarne Stroustrup in the 1980s and implemented C (initially called "c with classes", C) with class. When the start C is an enhanced version of the C language, you can think that C is the father of C . On the one hand, the C language is derived from C and keeps compatible with C, on the other hand, from the class, derived, access control, etc., derived, access control, etc. from the SIMULA language, the object-oriented concept is firmly tiered in the belt class C. Stroustrup has bundled C with Elegant bundle of C and Simula to create early C . Subsequently, various new features such as virtual functions, operator overload, multiple inheritance, template, anomalies, RTTI, name space, etc. are continuously increased to C . Each feature of C is increased to solve the actual needs rather than just for aesthetics. In 1998, the National Standards Bureau Language Standardization Committee will jointly issue the International Standard ISO / IEC 14882-1998 of C programming languages ​​with the International ISO Standards Organization. Modern C language supports process programming, data abstraction, object-oriented programming, generic programming, etc., can fully meet all kinds of users and systems for open, high efficiency, compatibility and scalability Harsh demand. . And with the advancement of technology and the demand of users, C is still further developed. Due to the intimate relationship between C and C , people usually together, and called C / C languages. Almost, C / C is the most powerful computer language today. She is not the most beautiful, but it is most useful. Unfortunately, since the C language is too complicated, and she has experienced long-term evolution until now (2004) is only a few 100% compliance with this standard compiler. But for beginners, these subtle differences can be ignored. Although C comes from C, she is an independent language, does not rely on C, we can do not learn C language, and learn C directly. Note: The above text part is derived from Wiki Bask. Why is C existing markets that have nearly 100 computer languages ​​that are familiar with people are familiar with people, and there are countless computer languages ​​that are not known by users. Then. Why have we chose C instead of anything else. First point, don't you see the cover? This is a book of C . How can you count on a book named C to tell Java? And you have to know that the author of this book is me, in fact, I only know C , and even know how to talk, but more familiar with other languages.

Second, more importantly, C has almost all of the advanced features of modern computer programming languages. Excellent features of other languages ​​can find the corresponding characteristics in C , even if a small amount cannot be corresponding, it can be simulated in C . In this way, after learning C , then learn other languages, there is no big obstacle. One through hundreds of piers is this. Third, C is a language that is both speed and collaborative. In programs written in various programming languages, the program written directly in assembly language is the fastest. C is second only to assembly, which can reach 98% to 99%. The program written by C can achieve 95% of the compilation after optimization, and in the most critical part, it can be run directly into the assembly language program. In addition to the speed, the various modern features of C make him suitable for collaboration development of large software. Imagine if there are 500 cases to develop a project, how difficult the coordination between them is. How to put together everyone's work results, how to ensure that the mistakes committed by someone do not have the mistakes or changes to the entire system, how to communicate with each other make it responding to a change. All of this, can be easier to do with the idea of ​​C and software engineering. The fourth point, due to the above characteristics, C is the most widely used language in the industry. For example, Windows system, each version of UNIX system, its main body is written in C / C . Due to the needs of speed and collaboration, most of the various databases are widely used. More than 90% of the video games were written in C / C . Moreover, the various supply libraries used by various routines, will first provide the interface of C / C . Whether it is computer graphics, encrypted decryption or other fields of computer programming, C / C is simply Mandarin, which is programmed. According to INTERNATIONAL DATA CORPORATION, C / C is the most programming language of global developers. If you really have to join the program, you don't understand C / C , it is Mission Impossible. However, in turn, no matter what the language is still in the future, there is no way to become a master, the most important thing, "not XXX language is not true", "is not bored. to. Learn C , mainly through his learning and programming ideas. Is it limited to the big sword in your hand? The popular C / C compiler and integrated environment introduces a lot of common compilers, there are commercial, free, with a Windiws platform, and other platforms. Our choice is still quite rich, but to pay attention to, once you choose a compiler, the best habitual use it, otherwise, the different features between the compiler will make you an endless, if you don't understand Why, look back to look at the contents of the function and the stream. Hey, the two boats are not only taboo when chasing girls. The most widely used personal system platform in China is Microsoft's Windows, the most common compilers under Win have Visual C Series, BorlandC Builder Series, GCC Series, and other unfamous compilers. Visual C first said Visual C series.

Visual C is a C integrated development environment, a member of the large programming development tool group in Microsoft, a member of Visual Studio (Word in MS Office), Visual Studio is often referred to as VS, while Visual C is often referred to as For VC or VC. VC and VS have the same version number, currently using more VC6.0 and VC.NET Edition. .NET is the next-generation application platform for Microsoft. Its concrete content is difficult to use a few sentences, with .NET promotion, Microsoft provides a new generation of large development tools group vs.net. VS.NET has two version 2002 (actual version numbers 7.0) and 2003 (actual version number 7.1), it is reported that Microsoft will launch a 2005 version in 2005. For beginners, it is recommended to use VC6 because this version of the system requires a low low (completely installed only about 200m or so, 400MHz chip WIN95 can run smoothly), and running speed is faster. .NET 2002/2003 requires a system over Windows2000 (and the components of the operating system is also upgraded), completely installed 3 ~ 5G hard disk space, 1.7GHz or more, 512M memory can run more smoothly. However, 2003 has some advanced features in C standards, especially templates, and STL, so when conditions permit and need these features, 2003 is a good choice. In addition, it is necessary to mention that the improvement of VC71 on VC70 is not a star half, but for beginners, these improvements can be ignored. VC supports standard libraries, because of the compiler of Microsoft, the compatibility with Microsoft's Windows platform is naturally no one. VC is usually used to develop Windows programs that can also develop programs (PS2, PLM, SYMBIAN, and POCKETPC, etc.) with extended development kits. VC provides several available application boxes, the most famous is MFC, although the MFC is more useful, but the truth, and the Borland's VCL library is not a point, so many people are rather. The VC is close to the bottom layer, even if the MFC is used, almost everything is done in person, so it is not very convenient for making a normal window program. But it is done by VC everything, so that the programmer can do everything, only can't think of it, no. So those procedures that do not use ordinary windows, such as games, drivers, background services, plug-in, and viruses, etc. are written using VC. In particular, the game, the video game industry (including various game consoles), 90% of the game comes from the VC. Using VC, it is a cumbersome, powerful, and started to learn for a long time. After proficiency, you can do it. All sample programs of this book are compiled in the Windows 2000 platform, and the VC60 environment. Then I want to introduce the giant Borland, another compilation world. For a long time, Borland has only produced a software-compiler. Fast, easy to use, stable, efficient, all you can think of excellent features, Borland's compiler owned. The king called the compiler, Borland is well-deserved. Although after 1996, under Microsoft's heavy gold excavation offensive, Borland's rays were gradually covered by Microsoft. However, the compiler made by Borland is still one of the best compilers on the earth. For C / C languages, Borland has produced a variety of compilers.

Among them, early Turbo C (TC), Borland C and the current main product Borland C Builder (BCB), no matter which one is aunt. Turbo C first said Turbo C, China's readers must be very familiar with this procedure, because the compiler used in the national computer level test is TC 2.0, which is always. In fact, another language of the level of exams, the compiler used is also Borland. As a national exam, the tool used by the exam is of course safe and stable. The TC2.0 version is already able to support C languages ​​well. If there is conditional, TC3.0 can be used, which has some more excellent features. In the compiler introduced in this book, TC has two major projects. First, he is the program under DOS. This means that it can run smoothly in very low configurations (such as systems that can only run DOS). In the Windows95 / 98 system, he can run smoothly. However, on the system of NT kernels such as Windows2000 / XP, the CPU usage will always maintain 100% when the system is running TC because the system is running TC. At the same time, he also means that the program is not large, completely installed TC3.0, only more than 300 files, about 7.6M. Second, he is only a few compilers that can be compiled in an integrated environment. I have explained this. The advantage of using TC is two words: small. Without complex settings, there is no gorgeous interface, very fast start speed, simple operation, fast compilation, no need to pay attention to the details of the system, as long as the language itself is very suitable for newbie learning and doing exercises. Disadvantages are also obvious, writing large programs (especially with graphical interfaces), can only create DOS programs. The DOS program can run in WIN, but not a standard Windows program. Borland C Builder Next is Borland C Builder, referred to as BCB. Common versions are 5.0, 6.0 and the new BCB X 1.0, and the popular version is 6.0. The system requirements of BCB60 are similar to VC60, and performance is also very powerful, especially in rapid development and database, BCB has an absolute advantage. A very good control library is provided in BCB, VCL (Visual Control Library), VCL can be said to be the best control library in the industry. At the same time, there are still many third-party software vendors that also provide controls that can be used in BCB. Using the Control Library Under the BCB, beginners only take five minutes, you can have a very standard Windows window program. And write the same procedure in the VC, it takes a long time to do it. The use of controls makes the programming under the BCB like a wooden wood, which is extremely fast. However, the disadvantages of using building blocks are, if there is nothing else you need, how to do it. You are waiting for someone else to make a building block to sell it, or you want to do a piece. If you want to do it yourself, then this building block wants what is required, and it can be squatted with other blocks without a gap. Using BCB programming, there will be a problem with the missing control. At this time, you can finally make what you want in order to understand all aspects of operating systems and controls. Otherwise, the programmer is only a small child, waiting for the ready building block. At this point, for programmers, whether using VC or BCB, all related knowledge must be mastered. Just use VC, you have to master them, making it difficult to get started. BCB is to ask you to master after you have written for a while.

If BCB is a prefabricated board sequentially stacked programming, VC is a castable in reinforced concrete, no matter which way, finally use cement to fill the gap. BCB also has outstanding performance on the database operation. Modern large programs often need to connect to database operation data in the background. This task is almost a nightmare for VC. But in BCB, this is a small dish. The rich control library and powerful database capability make BCB a preferred choice for commercial procedures. At the same time, according to a relatively fair evaluation, Borland's compiler is almost the fastest industry, and the degree of optimization is also quite good. This, VC is slightly inferior. But BCB is not no weakness. The first terrible weakness is that BCB is not as stable as VC, especially when debugging, BCB tends to jump out for no reason, and below, VC rarely has this situation. In this regard, I would rather believe that Microsoft left a hand when giving Borland About Windows. The second weakness is more difficult to forgive, and the compatibility between the BCB versions is not good. The project created by VC1.0, which can be compiled smoothly in VC6.0. But even BCB5.0 is engineered, it will be compiled in BCB6.0, and there will be a lot of errors. This, I think it is, it can also be considered that the degree of change between the BCB has a relatively large change, that is, the BCB progress is faster. But for companies that have many old projects, this is relatively unfavorable. In the third point, there is no substantial impact, but people will feel uncomfortable. VCL is actually written in C , which is written in another signature language of Borland. Borland has a compiler with the same excellent Pascal language, Delphi, it can be said to be BCB's big brother. The VCL is actually a Delphi control library, which is directly taken by BCB. So, if you need to quickly and easily write a regular interface, or you need to hook a variety of databases, and if you don't have much old project needs to be done, then BCB is your no batch. As for the VC ratio, it is a personal preference. All compilers mentioned above Borland C Builder Chammand Line are commercially available. If you are using, please pay attention to the copyright issue. However, the following will be mentioned is a completely free compiler, he is the Borland C Builder Command Line, BCB command line compiling version. We already know that BCB is an integrated development environment, consisting of many tools and procedures, is the same, VC is also the same. But generous Borland takes into account the needs of programmers (you have to know, in Borland's most outstanding programmer), remove the BCB's compiler section separately, constitute a complete tool, free to users, This is the BCB command line compiling version, which can be referred to as BCB CL. BCB CL is based on BCB5.5, in fact, he is the compiler portion of BCB5.5. So, the BCB CL does not have a window interface, and there is no VCL control library, but there are standard libraries and standard class libraries, only compiled features. To use it, you can only be in the command line, so it is called the command line compiling version. It can find downloads on the home page of Borland, files 8.7m, after installation is 65.9m, 1438 files. Know that you can, free, you can only compile in the command line, you can download.

VC's command line compiling version actually VC does not have a formal so-called command line compiling version, VC and BCB, itself supports command line compilation, but Microsoft did not introduce a simple command line compilation version similar to the Simplified window similar to BCB. Microsoft did not do, the hackers did it, impeeding the BCB's idea, extracting the needs of the required part, making a separate tool, is the command line version VC. This thing is very good, the space is small, only one problem, this is an illegal process. People who need need can go online to find themselves. Next, GCC refers to GCC, you have to mention the GNU, and then refer to the open source movement, then divert back to UNIX communities and hackers. If you talk fine, then this is not a C trip, but a GNU's risk. So I just want to mention it, the specific to the dragon, everyone is still going to the forum to see the story. Say, a long time ago, the mammal has not appeared, the dinosaur ruled the Earth. Er, wrong. It has not yet appeared in the PC, and the mainstream operating system is it? ? ? I don't know if I said. At that time, the software was free and free, and it was a hacker freely active era. Later, UNIX appeared, the PC appeared, Windows appeared. Many software manufacturers have appeared, they charged their software, and the big company rely on software to earn high profits. Software is monopoly in the hands of the big company, the source code is no longer disclosed, learning is impossible, modifying software is not allowed, the software is no longer free to spread, copying software is illegal. The hackers full of freedom to tolerate such things, so 1984, hackers Richard Stallman created the concept of free software. The main connotation of free software is that users can freely run software, can freely modify software according to their requirements, users can sell software themselves, whether they are charged or free. Free software is not conflicting with the sale software. This concept is widely accepted and forms a convention for providing source code while providing programs, which is usually the open source movement. The foundation of the open computer is the operating system. Only there is a "complete free" operating system to have free software. Therefore, Richard Stallman starts attempting to write an operating system that can be compatible with UNIX. This project is named GNU. It is a recursive abbreviation for GNU IS Not Unix. The computer operating system not only has a kernel. It is a collection of software. Includes kernel, compiler, editor, debugger, etc. In the GNU project, through many people's efforts, components have a complete excellent editor, compiler, and many excellent software. The compiler in the GNU project is the GCC (GNU Compiler Collection GNU compiler collection). GCC is a powerful and superior multi-platform compiler introduced by GNU, one of the representatives of GNU. He can compile the executable on a variety of hardware platforms, and its effectiveness is 20% to 30% higher than the general compiler. Moreover, he is not just a C language compiler. He is a collection of compilers in many languages, supports many or unknown languages ​​for C, C , LISP, Object C. Since GCC is developed for UNIX platforms, the basic operation of GCC is the command line, which is similar to BCB CL.

After the efforts of hackers, GCC has been ported to Windows, which can be used in any version of Windows, but it is still command. Why don't have an IDE (integrated development environment), hacker explanation is that we can also develop a program to provide an integrated environment, he does not provide compiletability, let GCC compile. In this way, the two programs can complete their own work, each of which is best. Based on this concept, people usually use Emacs and so on text editor under UNIX. Under Windows, there are several IDEs, which are more famous (it is also familiar), called DEV-C . Developed with DEV-C with GCC and has good efficiency. Of course, in some auxiliary functions, such as automatic completion, no VC, BCB this tool is good, but if you add using a third party's enhancement tool, not only make up for the defect, but also have a small transcendence, I like an external hang in the legend, the result is a cattle fork than GM. C compiler is really a lot, the following is a list of compiler collection, refer to "C compiler Recommended List" article, author: Bjarne Stroustrup (the father of C ), Translator: Chen Xi, translator Blog: http : //blog.9cbs.net/sunwhite can download compiler for free (when trying to use, check it): Apple C - can be obtained from OS X in the developer tool CD, this mill Undoubtedly the Bloodshed DEV-C - Based on the MAC-based (MINGW) IDE environment, it is said. Borland C has been told, this refers to the command line. Cygwin (GNU C ) MINGW - "Minimalist GNU for Windows". ······················································································· DOS / Windows (GNU C ) GNU CC Source Intel C for Linux ······ This is a few more words. This is Intel's compiler. It is reasonable to say that he should be the most intelral X86 series chip performance. The compiler, who can more familiar with the 80x86 chip than Intel. If Borland can work with Intel, it may be possible to have the best compiler on the PC.

The compiler that needs to be paid (some allows for free downloads for the evaluation period): Borland C · ····· TC, BC and BCB series Comeau C ····· Support multi-platform COMPAQ C Digital Mars C Edison Design Group C front end ···· Many C compiler manufacturers use Green Hills C ···· Support Embedded System Platform HP C IBM C Intel C ···· Supports Windows, Linux, and other embedded systems interstron C Metrowerks C - support multi-platform, you can query Mentor Graphics / Microtec Research C ···· Support Embedded System Platform Microsoft C Paradigm C ···· Support X86 Embedded System The Portland Group C ···· For the Pentium CPU Optimization SGI C ···· Optimized Compiler Sun C WinDriver's DIAB C ···· It is used for many embedded system authors to mention a small program in the article, used to verify the C compiler pair you selected. The support situation of the grammar and standard library, the procedure is as follows: #include #include using namespace std; int main () {string s; cout << "please enter your first name backed by a newline / n"; cin >> s; cout << "Hello," << S << '/ n'; return 0; // this return statement isn't Necessary} I will tell you how to use this program in the future chapter, now let us end Introduce the compiler. Finally, to remind everyone, whether it is VC, BCB, GCC or other compiler, their difference is only to provide different package libraries, different operation interfaces, and different optimization methods for code. Choose a compiler, the final selection right may not be in your hands, many times the platform or other factor restrictions, causing you to use some compiler. The true key issue is C . Some assumptions about the project In order to discuss, I need to make assumes that you need to save your source files on the machine. If you use Microsoft's DOS and Windows Series operating systems, I assume that your source file is all stored in the E: / CPPCode directory. If you use Linux, FreeBSD, Solias, these UNIX systems, I assume that you are a user named develops, and the source file is stored in the / home / development / cppcode directory. If you need a project called Projxx, he is stored in E: / CPPCode or / Home / Develop / CPPCode / Projxx. If your project location, the project name, the file name is different from my hypothesis, and in the operation of the directory location, please modify it accordingly. Summarize OK, let our friends Wang Second to discuss these concepts. One day, Wang Er needs to do things with a computer, this is the beginning. Wang Er decided to use the computer to do it, this is called computer. Wang Er opens the power supply, touch the chassis, this is called hardware.

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

New Post(0)