|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
如题:下面程序无法编译,编译错误为:文件中的#if/#endif对不匹配;应该如何修改?求助各位大佬,拜谢啦。
//宏定义,2022.2.19。
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#define M 12
//#define M 13
//#define M 500
#if M < 13
#undef M
#define M 13
//#error
#if M < 500
#define N M / 2 - M / 10
#else
#define N M / 5
#endif
int main(void)
{
printf("M = %d, N = %d", M, N);
getch();
return 0;
}
- //宏定义,2022.2.19。
- #include<stdio.h>
- #include<stdlib.h>
- #include<conio.h>
- #define M 12
- //#define M 13
- //#define M 500
-
- #if M < 13
- #undef M
- #define M 13
- #endif // 加上这行
- //#error
- #if M < 500
- #define N M / 2 - M / 10
- #else
- #define N M / 5
- #endif
- int main(void)
- {
- printf("M = %d, N = %d", M, N);
- getch();
- return 0;
- }
复制代码
|
|