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
, you can also simply use the Debug macro or printf function printing. Specific or personal habits. There's only one goal anyway: Improve code stability.7, Programming exercises (title 7):1#include 2 3 voidBoth (void);4 voidOne_three (void);5 6 intMainvoid){7printf"starting now:\n");8 One_three ();9printf"done!\n");Ten return 0; One } A - voidBoth (void){ -printf"two\n"); the } - - voidOne_three (void){ -printf"on\n"); + both (); -printf"three\n"); +}Operation Result:Starting now:OnBot
1. OOP emphasizes the decision-making during the run phase, not the compile phase, when the program is running, while the compile phase refers to when the compiler combines the program.2. The value of the variable is stored in the stack, and new allocates memory from a memory area known as a heap or free storage area.3. Static linking: It is added to the program at compile time.Dynamic linking: Created when the program is running.4. The array name is interpreted as the address of its first eleme
" - "Max is" $ "min is"Endl; the } the the Drive the#include -#include in#include string> the#include the#include"Sales.h" About using namespacestd; the the intMain () { thecout "Enter a number you want to fill the array\n"; + intn, I; -CIN >>N; the Double*ar =New Double[n+1];Bayicout "Enter an double array\n"; the for(i =0; I ) theCIN >>Ar[i]; - sales::sales Ex1, ex2; - sales::setsales (Ex1, AR, n); the sales::setsales (EX2); the sales::showsales (EX1); the sal
:\n"; C1. Report (); C2. Report (); //Cd SD;cout"using Type cd * pointer to object:\n"; PCD-Report (); PCD= C2; PCD-Report (); cout"calling a function with a Cd reference argument:\n"; Bravo (C1); Bravo (C2); cout"Testing Assignment"Endl; Classic copy; Copy=C2; Copy. Report (); return 0;}voidBravo (ConstCd disk) {disk. Report ();}Test.cppCall the base class construct first, then call the derived class construct, the destructor instead, call the derived class destructor firs
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.