2016-12-04 73 views
-1

我目前正在努力学习C++的基础知识。我使用视觉工作室,并发现了一个奇怪的问题:visual studios cout << not working

#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吗?

+2

定义添加的#include''哦 – wally

回答

2

你忘了#include <string>其中operator<<std::string

+0

,OK。我在看的教程没有提到这一点。谢谢! :-) –

相关问题