into 3 categories:Non-template friends, friends themselves are not template functions, but only use the implicit instantiation of the template class as parameters.Constraint template friend, each materialization of a class obtains a matching friend, and the type of friend depends on the type of materialization. Declare a friend function template outside the class declaration.Non-constrained template friend, each materialization of a friend is all materialized friends of the class. Declare a fri
generates the executable file a.out:g++ Spiffy.cxxSome versions may require links to C + + libraries:g++ spiffy.cxx-lg++To compile multiple source files, simply place them all on the command line:g++ My.cxx Precious.cxxThis will generate a copy of the executable file named A.out and the two target code files my.o and PRECIOUS.O. If you subsequently modify one of the source code files, such as My.cxx, you can recompile using MY.CXX and PRECIOUS.O:g++ My.cxx PRECIOUS.O3.Windows command-line compi
One of the great features of C is that it allows us to control the details of the program. C's memory management system is an example of this control capability. It implements these controls by letting us decide which functions know which variables and how long a variable exists in the program.1. Storage classes and their descriptorsThe main definition: scope, link, and storage time. Other programming languages also have similar concepts. The C language defines 5 storage classes through these th
is passed as parameter, and the original data is processed directly. 3. Other three types of data processing featuresHere's a brief look at the other three characteristics of processing data: Union, enumeration, and typedef.A union is a data type that can store different types of data in the same storage space (but at different time). Each variable is "mutually exclusive"-the disadvantage is not enough "containment", but the advantage is that memory usage is more granular and flexible, but also
the conversion is that it converts the numeric values stored in the computer's binary format into a series of characters for easy display. The "transformations" here can be understood as "translations".The 4.4.4 section focuses on mismatched conversions, which involve a lot of computer knowledge at the bottom. In particular, parameter passing works: The computer places the value of the variable on the stack, but reads it according to the conversion descriptor.In addition, the printf () return v
the parameter to the function, and before compiling, the macro calls the language symbol of the argument to the program. #define Square (x) x*xx=4evaluating Square (x): The result is a //aevaluating square (2): The result is 4 B evaluating SQUARE (x+2): The result is a //c evaluating 100/square (2): The result is a //dFor A, B results are the same. But the other results are different.The original x*x parameter in C should be x+2*x+2D is 100/2*2, so we should count 100/2 first.
C
font s) change size a) change alignmentb) Toggle Bold i) Toggle italic u) Toggle UnderlineQ) quitQbye!A program should use the operator and the appropriate mask to ensure that the font ID and font size information are converted to the specified range.#include 7. Write a program that is identical to the functionality described in Exercise 6. Use a unsigned long to save the font information, and use the bitwise operator instead of the bit member to manage the information.#include This article is
are abstracted into a unified "thing" to operate, do not need to tube specific equipment and location, like a river, a lot of tributaries, but the tributary of the water once flowed into the main river, that from the downstream view of the water is main river water, not related to tributaries. With the concept of "flow", computer programming allows for uniform operation of inputs and outputs. Different types of input sources can be manually or automatically change the input to run the program.
parameters, first parameter output stringAddress, the second parameter file pointer, writes a string to the specified fileRandom AccessFseek () (Navigate to the file in that position) three parameters: the first parameter file refers to aThe needle points to the file being searched; The second argument: The offset indicates that you want to move from the starting pointThe distance Long data type is positive forward negative back shift 0 hold still; the third parameterIs the starting point in wh
Operator Overloading of C ++ Primer Plus learning notes 1. Recommended selection of member functions and friend functions: Let's take a look at two examples: member function Overloading
# Include
Using namespace std; class Complex {public: Complex (double r = 0, double I = 0) {re = r; im = I ;} complex operator + (const Complex obj); Complex operator! (); Void Display (); private: double re; double im
// C primer plus// Use Pointer in Structure// Allocate memory space to pointers in the Structure// Free releases the previously allocated memory space# Include # Include # Include
# Include "tsong. H"
Struct namect {Char * fname;Char * lname;Int letters;};
Void getinfo (struct namect *); // enter the nameVoid makeinfo (struct namect *); // calculates the length.Void showinfo (const struct namect *); // pri
C ++ primer plus
Chapter 3 processes data
1 simple variable
1.1 integer limit
// limits.cpp -- some integer limits#include
1.1.1 climits
Climits files store the maximum and minimum limits of various types. Find this file and view
#pragma GCC system_header#include
Without the int_max definition, continue to search in limits. h file and find such definitions.
/* Minimum and maximum values a `signed int
Branch Enum: Declares the enumeration type. Register: declare the memory variable Typedef: Used to get an alias for the data type (of course there are other functions) CHAR: declare struct variables or functions Extern: declared variables are declared in other files (or can be seen as referenced variables) Return: subprogram Return Statement (which can contain parameters or not) Union: Declares the Union data type. Const: declare Read-Only variables Float: Declares floating point varia
Dynamic storage The new and delete operators provide a more flexible approach than their own active and static variables.They manage a pool of memory, which is called a free storage space or heap in C + +. The memory pool is common to static variables and the memory of its own active variable is separate. Therefore, the life cycle of the data is completely unaffected by program or function lifetime. Compared to regular variables, using them gives the program ape more control over how the p
Learning Summary1. The C base data type uses 11 keywords: int, long, short, unsigned, char, float, double, signed, _bool, _complex, and _imaginary.2. In standard C, integer 0 is false, and integers greater than 0 are true. Char can actually be printed as an integer.3, octal is prefixed with 0, hexadecimal is expressed in 0x or 0X.4, can use the sizeof keyword query type length, if sizeof (int). C99 has a portable type (inttype.h): int16_t, unint32_t, etc., mainly for code portability.5, Programm
AAAInput: Aaabbbccc[enter]dddeeefff[enter]ggghhhaaa[enter]Output:AaabbbcccGgghhhaaa5, in creating a program with the user, you need to take into account all the boundary problems, such as the program only requires the user to enter a, B, C, D, in case the user input of other and a large number of characters will be handled, and so on. There are also programs that require getchar for character input and digital input using scanf, each of which can do its job well, but they do not mix well, becau
Learning Summary1. The C language was developed by Dennis Ritchie of Bell Labs in 1972 when designing UNIX operating systems with Ken Thompson. 's design is derived from Ken Thompson's B language. Anyway, it is the product of 70th century, the existence is reasonable.2, because Unixlinux are based on C language development, so, C ubiquitous: games, operating systems, computer language, embedded, applications ...3, c implementation sequence: source (. c) → compiler → target code (. obj) → linker
Learning Summary1, with a certain language basis, operators and expressions These are very similar, there is no difference between the assignment operator (=), arithmetic operators (+ 、-、 *,/,%, + + 、——) and other operators (sizeof, (type)).2, declare a parameter to create a called formal parameter (formal argument) or formal parameters (formal parameter). We call a function call passing a value called the actual parameter (actual argument) or the actual argument (actual parameter).3, Programmin
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.