#include<iostream.h>
#include<string.h>
using namespace std;
int main()
{
string user_name;
cout<<"please enter your first name:";
cin>>user_name;
cout<<'\n'
      <<"Hello,"
      <<user_name
      <<"...and goodbye!\n";
return 0;
}--------------------Configuration: 01 - Win32 Debug--------------------
Compiling...
101.cpp
e:\我的文件夾\vc++\01\101.cpp(3) : error C2871: 'std' : does not exist or is not a namespace
e:\我的文件夾\vc++\01\101.cpp(6) : error C2065: 'string' : undeclared identifier
e:\我的文件夾\vc++\01\101.cpp(6) : error C2146: syntax error : missing ';' before identifier 'user_name'
e:\我的文件夾\vc++\01\101.cpp(6) : error C2065: 'user_name' : undeclared identifier
Error executing cl.exe.01.exe - 4 error(s), 0 warning(s)using namespace std;我還是不清楚

解决方案 »

  1.   

    using namespace std;
    你去掉就好拉
      

  2.   

    #include<iostream.h>
    //#include<string.h>//using namespace std;   什么意思?int main()
    {
    char user_name[10];
    cout<<"please enter your first name:";
    cin>>user_name;
    cout<<'\n'
          <<"Hello,"
          <<user_name
          <<"...and goodbye!\n";
    return 0;
    }
      

  3.   

    using namespace std 是很有用的,它是一个标准c++的命名空间,其详细说明我建义你看看这本书<<Thinking in c++>>
      

  4.   

    #include<iostream.h> 和 #include<iostream>是不同的,
    如果你使用的是标准C++,那么用后者;如果你使用微软提供的,那么用前者。
    使用后者时,你就需要使用using namespace std
    使用前者时,因为你没有定义std namespace,所以无法编译通过
      

  5.   

    STL库的头文件不带.h扩展名。
      

  6.   

    VC下用#include<iostream.h>就可以了
      

  7.   

    VC下用#include<iostream.h>就可以了
      

  8.   

    string.h是对的,不过有的编译器要include "string",不支持.h
      

  9.   

    #include <iostream.h>
    #include <string.h>改为标准库头文件:
    #include <iostream>
    #include <string>
      

  10.   

    #include <iostream.h>
    #include <string.h>中没有命名空间std的定义,所以会出现错误提示,它的定义在
    #include <iostream>
    #include <string>中,此外string 的定义在<string>中,而不是<string.h>中,
    <stirng.h>中定义的是strcpy 等C的字符串操作函数
      

  11.   

    #include <iostream.h>
    #include <string.h>中没有命名空间std的定义,所以会出现错误提示,它的定义在
    #include <iostream>
    #include <string>中,此外string 的定义在<string>中,而不是<string.h>中,
    <stirng.h>中定义的是strcpy 等C的字符串操作函数