C ++ IDE BEAN 1.6.9问题

时间:2011-03-16 05:03:30

标签: c++ cout

#include <iostream>

using namespace std; //error here

int main()
{
    cout << "COME AT ME BRO!\n"; //error here
    return 0;
}

cout是不可取的。我之前遇到过这个问题,但是我的编译器没有工作,所以我重新安装了IDEBean,并且从第一个方面再次遇到了同样的问题。帮助:?

2 个答案:

答案 0 :(得分:0)

cout位于std命名空间内。因此,您应该使用std::cout<<"...";或另一个选项是在开始时执行using namespace std;,然后您可以使用cout<<"...";

答案 1 :(得分:0)

 std::cout << "COME AT ME BRO!\n";
{p> coutstd命名空间中定义。因此,您需要在每std::之前放置cout。你是如何有选择 -

#include <iostream>

using namespace std ; // Do this if you need include everything defined in the namespace
using std::cout ;     // If the program just uses cout of std namespace
int main()
{
    cout << "COME AT ME BRO!\n";   // Now you are free from keeping std:: before cout
    return 0;
}