#include <stdio.h>
#include <cmath>
#include <iostream>
using namespace std;
#define pi 3.1415926;
//const double pi=3.1415926;
int main(){
// printf("%f",(atan2(-1,1)*180/pi));
cout<< atan2(-1,1)*180/pi;// <<endl;
}
The program is as above. The output is normal under the above circumstances, but after slight modification, the following problems occur.
The program reports an error when adding <<endl. Starting another cout<<endl can output normally.
I tried adding brackets to <<endl, but still got an error.
I tried to use printf to output, but found that it could not be output without adding n.
Everything works fine when using const constants
I don’t understand why macros are not directly replaced? Why is there a problem?