我当前正在尝试学习C 的基础知识。我正在使用Visual Studios,发现一个奇怪的问题:
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
string name = "Example name";
cout << "Hello " << name << endl;
int pause;
cin >> pause;
return 0;
}
我不能使用"&lt;&lt;"尝试输出我的字符串两次。它显示了第二个&lt;&lt;&lt;不让我编译。有答案吗?我应该只使用另一个IDE吗?
您忘记了#include <string>
,其中operator<<
定义为std::string