c++ error: expected ‘,‘ or ‘...‘ before numeric constant|

还是关于宏的问题,在条件编译的时候,不要将#if的常量表达式提到文件包含之前,放在其后便不会报错:


#include 

#define flag 1          //#if 的常量表达式
#define PI 3.14

using namespace std;

int main()
{
    double radius,sr,a,ss;
#if flag          //根据常量表达式的真假对不同的程序块进行编译      //
    {

        cout<<"input radius:"<>radius;
        sr=PI*radius*radius;
        cout<<"the circle area is:"<>a;
        ss=a*a;
        cout<<"the square area is:"<

 

你可能感兴趣的:(C++)