#if 0 #elif 1 #else #endif 用法

跟我们平时用的if,else if,else一样,不同的是这里一定要记得#endif

#include<iostream>
using namespace std;
# if 1
int main()  
{
	cout << "if 0" << endl;
}
#elif 1
int main()
{
	cout << "elif 1" << endl;
}
# else
int main()
{
	cout << "else" << endl;
}
# endif

#######输出结果########
if 0

if后面是表达式或者0 或者1.如果是1或者表达式成立就执行。如果是0不执行。

猜你喜欢

转载自blog.csdn.net/weixin_38383877/article/details/88999989
今日推荐