我目前正在尝试学习C ++的基础知识。我正在使用视觉工作室,却发现了一个奇怪的问题:
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
string name = "Example name";
cout << "Hello " << name << endl;
int pause;
cin >> pause;
return 0;
}
尝试输出我的字符串时,不能两次使用“ <<”。它在第二个<<下显示红线,不会让我编译。有什么答案吗?我应该只使用另一个IDE吗?
你忘了在#include <string>
哪里operator<<
定义std::string
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句