在 C++ 中定义宏的问题

Troubles with defining a macro n C++

出于某种原因,我正在尝试测试老师给我们的这个宏 我不断收到错误消息。有谁知道为什么?我好像不能 搞清楚。

#include <iostream>
#include <string>
#define die(errmsg) {cerr << errmsg << endl; exit(1);}
using namespace std;


int main()
{
    int x;

    for(;;)
    {
        cout <<"How are you: " <endl;
        cout <<"1) good\n"; 
        cout <<"2) bad\n";

        cin >> x;

        if(x != 1 || x != 2)
            die("Invalid input");
    }



    return(0);
}
cout <<"How are you: " <endl;

你在第二个 <<

中错过了一个 <

检查这个循环:

    for(;;)
    {
        cout << "How are you: " < endl;
    }

您在 std::endl

之前缺少 <
    for(;;)
    {
        cout << "How are you: " << endl;
    }