1.这是c++新的库为了兼容原有的函数库所以提供了两个版本的函数,为了区别就把新的库定义在名字空间std下,可以这样用std::xxx,所以你的程序可以通过;
2.不知道

解决方案 »

  1.   

    yg_xh(果皮):
    不要using namespace std;我的程序也能通过啊?
    我是<string>不是<string.h>
      

  2.   

    There is a file named "string", which can be found by VC. In fact it is a convention to C++, and string.h is the standard or older header file of ANSI C. And C++ has rewritten it using string, without suffix .h, to tell you their difference. To C++, the standard string.h is renamed to cstring, that is, when you include cstring, in fact you include the string.h. Of course, the string.h has still existed, especially to ANSI C user. So you can write what you wrote above and realize what you want. But, the best practice is to using cstring in C++ program, and use string.h in C program. As of the statementusing namespace std;it is another practice, which will be allowed to use function defined in namespace std, that is to usestd::xxx Nothing else.
      

  3.   

    Sorry for my mistaken.If you use using directive using, you can use cout, cin etc without appending std::; else you should add!
      

  4.   

    __cplusplus是用来判断是不是符合C++规范。
      

  5.   

    你又没有声明一个string类,当然能通过了啊。
    你试着写一句
    string s; 看看
    保证你通不过。当你使用string的时候,你必须得加using namespace std;
      

  6.   

    programcat():
    你的意思是 #include <string> 没有派上用场?在这个程序中是可有可无的?但是你把 #include <string> 去掉,那个程序就编译通不过了
      

  7.   

    那是因为你去掉<string>之后,NULL没有定义。
    你可以自己定义
    加上const int NULL=0;这句
      

  8.   

    我以为下面两句是要一起用的:
    #include <string>
    using namespace std;   
    但这道题中,确可以不要using namespace std;  这是为什么?
      

  9.   

    我以为下面两句是要一起用的:  
    #include    <string  >  
    using  namespace  std;        
    但这道题中,确可以不要using  namespace  std;    这是为什么?