Describes various programming skills of C ++.

Source: Internet
Author: User

The variable names in C ++ are case-sensitive. The following variables are different: int XPos; int xpos; if your original language is not case-sensitive, such as Pascal ), the language considering case sensitivity may not be quite suitable. I 'd like to share it with you here.

The C ++ language has its own monograph. This book is still very thick, so don't expect me to be clear in just a few words. After learning this book and using C ++ Builder for a general period of time, the reader finally gives a more in-depth understanding of the C ++ language. C ++ can take full advantage of Object-Oriented Programming (OOP. OOP is not just a new term, but has its practical significance. It can generate reusable objects.

The new term object, like the component described above, is the software block component that completes a specific programming task, but the object is not all component, which will be explained later ). Objects only show the required parts to the programmers who use the objects. This simplifies the use of objects. All 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 each time. The C ++ Builder program is oriented to OOP, because C ++ Builder uses a large number of components. After a component is generated, you can use it again in any C ++ Builder program.

The components can also be expanded to generate new components with new functions through inheritance. The best thing is that the component hides all content details, allowing programmers to focus on making full use of the component. C language is available before C ++. C ++ is built on C language and is called "C language with classes ". This C language is still very important in today's C ++ programs.

  • Exploring various concise and flexible features of C ++
  • How to Use the Visual C ++ subset to search for a topic
  • How to better learn C ++ -- and a summary of C ++ learning methods
  • Advanced Programming instructions on C ++ learning methods
  • Better understanding of C ++ programming learning and research

C ++ does not replace C, but supplements and supports C. The remaining part of this chapter and the following chapters mainly introduce the C language. In fact, the C language is introduced here. Only C ++ is transferred to C ++ in Lesson 2nd "C ++ basics. Readers do not have to worry about which is from C and which is from C ++, because all these are in C ++.

C ++ is difficult to introduce in sequence, because all the features we will introduce are cross-cutting. I prepared an introduction and pieced it together. By the end of Lesson 3rd "Advanced C ++", you will have a complete understanding of the C ++ language. It doesn't matter if you don't have a certain concept. Some concepts must be fully understood after practice.

Let's start with the variable. Variable is actually the name assigned to the memory address. After declaring a variable, you can use it to operate data in the memory. The following are examples. Two variables are used in the following code segments. The statements at the end of each statement describe what happens when the statement is executed:

 
 
  1. int x;// variable declared as an integer variable   
  2. x = 100;// 'x' now contains the value 100   
  3. x +=50;// 'x' now contains the value 150   
  4. int y = 150;// 'y' declared and initialized to 150   
  5. x += y;// 'x' now contains the value 300   
  6. x++;// 'x' now contains the value 301  

The new term variable is used as the computer memory address to store a value. Note that the value of x Changes During Variable operations. The C ++ operator of the Operation variable will be introduced later. Variables declared with warnings but not initialized contain random values. Because the memory to which the variable points has not been initialized, you do not know the value of the memory address.

The new term variable is used as the computer memory address to store a value. Note that the value of x Changes During Variable operations. The C ++ operator of the Operation variable will be introduced later. Variables declared with warnings but not initialized contain random values. Because the memory to which the variable points has not been initialized, you do not know the value of the memory address.
For example, the following code:

 
 
  1. int k;   
  2. int y;   
  3. x=y+10; //oops!  

In this example, the variable y is not initialized in advance, so x may obtain any value. The exception is that the global variable and the variable declared with static modification are always initialized to 0. All other variables include random values before initialization or assignment. Variable names can contain uppercase letters, lowercase letters, numbers, and underscores (_), but cannot contain spaces or other special characters.

The variable name must start with a letter or underscore. Generally, it is not good to start with an underscore or double underscore below the variable name. The maximum length allowed by the variable name varies with the compiler. It is absolutely safe if the variable name is kept below 32 characters. In reality, any variable name that exceeds 20 characters is not practical.

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.