p1-99.cpp
来自「c++200源代码」· C++ 代码 · 共 18 行
CPP
18 行
#include<iostream.h>
//以下为带参数宏替换的预处理指令
#define PRINT(k) cout<<(k)<<endl;
#define MAX(a,b) ((a)>(b) ? (a):(b))
main()
{
int i=3,j=2;
//MAX(a,b)宏替换的使用
cout<<"MAX(10,12)="<<MAX(10,12)<<endl;
cout<<"MAX(i,j)="<<MAX(i,j)<<endl;
cout<<"MAX(2*i,j+3)="<<MAX(2*i,j+3)<<endl;
//PRINT(k)宏替换的使用
PRINT(5);
PRINT(MAX(7,i*j));
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?