In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is about how to define a compiler with C++ data types. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article. Let's take a look at it with the editor.
Many programmers learn C++ to sum up experience, some feel that C++ language is an independent language, not on the basis of C language, you can learn C++ directly without starting from C, the following C++ data types are shared for everyone to learn and communicate with each other.
C++ is a powerful language that can be used to do jobs that no other language can do. However, this powerful function comes at a price. When you start using C++, you may encounter problems such as memory overflow and access invalidation, causing the program to crash. Here is the shortest space to introduce the language basis of C++. The C++ data type itself has monographs, and this kind of book is still very thick, so don't expect me to be able to explain it clearly in a few words. After readers have finished learning this book and using C++ Builder in normal time, * will have a better understanding of C++ language.
C++ can make the most of the advantages of object-oriented programming (OOP). OOP is not only a new term, but also has its practical meaning. It can generate reusable objects. The new term object, like the artifacts described earlier, is a software block that performs specific programming tasks (artifacts are objects, but not all objects are artifacts, which will be explained later).
The object simplifies the use of the object by displaying only the necessary parts to the user (the programmer who uses the object). All the internal mechanisms that users do not need to know are hidden behind the scenes. All of this is included in the concept of object-oriented programming. OOP can be programmed in a modular way to avoid starting from scratch every time.
C++ Builder programs are OOP-oriented because C++ Builder uses a lot of widgets. Once the widgets are generated (the ones you generate or built into C++ Builder), they can be reused in any C++ Builder program. Components can also be extended to generate new components with new functions through inheritance. Best of all, the component hides all the details of the content, allowing programmers to focus on making full use of the component.
Introduction to getting started
Before C++, there was C language. C++ is based on C language, which is called "C language with classes". This C language foundation is still very important in today's C++ programs. C++ does not replace C, but complements and supports C. The rest of this chapter and the following chapters mainly introduce the part of C++ that comes from C language.
In fact, the C language is introduced here, and it is only then transferred to C++ in lesson 2, "the basics of C++". Readers don't have to care about which is from C and which is from Caterpillar, because it's all in C++. It is difficult to introduce the C++ language in order because all the features we are going to introduce are cross-cutting.
I prepared to introduce one piece at a time, and then piece it together. By the end of lesson 3 "Advanced C++", you will have a complete understanding of C++ language. It doesn't matter if you don't grasp a concept all of a sudden. Some concepts can only be fully understood through practice.
Variable
Let's start with variables. The variable (variable) is actually the name assigned to the memory address. After you declare a variable, you can use it to manipulate the data in memory. Here are a few examples to illustrate. The following code segments use two variables, with a description statement at the end of each statement describing what happens when the statement is executed:
Int x declared and initialized to int / variable declared as an integer variable x = 100 x now contains the value / variable declared as an integer variable x = 100 x now contains the value /'x 'now contains the value 100 x + = 50 x x' now contains the value 100 x + = 50 x x 'now contains the value 150 int y = 150 x x' now contains the value 150 x + = x x now contains the value 300 x balance
The new term variable (variable) is the memory address of the computer where a value is stored. Note that the value of x changes when the variable is manipulated, and the C++ data type of the operation variable will be described later. Warning declared and uninitialized variables contain random values. Because the memory to which the variable points has not been initialized, it is not known what value the memory address contains.
Int k; int y; Xerox 10; / / oops!
In this case, the variable y is not initialized in advance, so x may get any value. The exception is that global variables and variables declared with static decorations are always initialized to 0. All other variables contain random values before initialization or assignment. Variable names can mix uppercase, lowercase letters, and numbers with underscores (_), but cannot contain spaces and other special characters.
Variable names must start with a letter or an underscore. Generally speaking, the variable name underscore or double underscore is not a good start. The allowed length of the variable name varies from compiler to compiler. It is absolutely safe if the variable name is kept below 32 characters. In practice, any variable name with more than 20 characters is impractical.
Int aVeryLongVariableName;// a long variable name int my_variable;// a variable with an underscore int_ / OK,but not advisedint / uppercase variable name int Labe12;// a variable name containing a number int GetItemsInContainer (); / / thanks Pete!
Indicates that the variable names in the C++ data type are case-sensitive, and the following variables are different: int XPos;int xpos; if your original language does not consider case (such as Pascal), it may not be appropriate to come into contact with a case-sensitive language.
The above is how to define the compiler with C++ data types. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 228
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.