The Define () function defines a constant.define () functions: Defines a constant. Constants is much like variables, except for the following differences: constants [constant] and variables [variable] There are many similarities, so it is easy to
Discounted faresStatic interval maximum number of SB problem#include usingnamespace Std;#define for (i,n) for (int i=1;i#define Fork (i,k,n) for (int i=k;i#define REP (i,n) for (int i=0;i#define ForD (i,n) for (int i=n;i;i--)#define forkd (i,k,n)
1 similarities and differences as constants (0) SameBoth can be used to define constants;#define PI 3.14159//Macro ConstantsConst DOULBE pi=3.14159; Constant(1) different compiler processing methodsThe Define macro is expanded in the preprocessing
1. Custom Constants
* Must be defined with function define ()
* The value can no longer be changed after the definition is complete.
* Use the constant name directly, not the same as the variable in the front plus $s
For example: Define ("PI", 3.14);
The header file is published to a specific output directory during the build process of a project.CodeTo include the header file from the specified output directory. In other words, in this way, the header file is equivalent to the final generated
# Define is a macro definition Command provided in C language. Its main purpose is to provide programmers with some convenience in programming and improve the program running efficiency to a certain extent, however, when learning this command,
Document directory
Common Pre-processing commands in C ++
1. include references to header files
2. Conditional compilation
3. # define definition macro
4. # progma
Common preprocessing commands
Common Pre-processing commands in C ++
As
Constant
Defined:
Form One// define("PI",常量值);define("PI",3.14);define("school","讲理");
Form Two// 定义形式二const1234;const"abcd";
Use:
Form One// 直接使用常量名echo"PI的值:".PI;
Form Two//
First, pre-processing instructions1. DefinitionC language before compiling the source program, will be some special pre-processing instructions to explain, such as: #include, to produce a new source program, this process is called "compilation
First, #define的基本用法#define是C语言中提供的宏定义命令, the main purpose is to provide programmers with certain convenience in programming, and to a certain extent, improve the efficiency of the program, but students often do not understand the nature of the
Introduction to preprocessing Directives
One, macro definition without parameters
Second, macro definition with parameters
Description: This C language topic is the prelude to learning iOS development. And for
#define是C语言中提供的宏定义命令, the main purpose is to provide programmers with a certain degree of convenience in programming, and to a certain extent to improve the efficiency of the program, but students often do not understand the nature of the command,
1. Macro Definitions without parameters:A macro definition is also called a macro substitution, a macro substitution, or a macro.Format:#define Identifier stringThe identifier is called a symbolic constant, also known as a "macro name."Preprocessing
1.5 C language Program running process01 source program: Written by high-level or assembly language, C language source program extension. C02 Target Program: The source program is translated by the "compiler" binary code is the target program, its
Try to replace # define with const, enum, and inlineFirst, #define的功能Reference: http://www.crifan.com/_define_detailed/(1) #define的变体, or #ifndef, prevents duplicate references to the head file#ifdef和 #define组合, typically used in header files, to
The use of the const keyword in C + + is very flexible, and using the const will greatly improve the robustness of the program, I found in various aspects of the information summarized below, hoping to help friends. Const is a type modifier commonly
DMR once said: C Bizarre, flawed, and to achieve such a great success.The data types in the C language 1.1 constants and variable constants are the amount of values that cannot be changed in a program, and are generally divided into shaping
POJ 2991 Segment tree + computational Geometry(2011-02-27 21:13:44)reproduced
Tags: gossip
Category: OI
The question is really disgusting and disgusting, but it does change my view of the line tree, which is a
Introduction to CC language structure is extremely compact, C language is a modular programming language, the entire program can be divided into several relatively independent function modules, mutual calls between modules and data transfer is very
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.