请问怎样做才能使用STL中的类和方法?

解决方案 »

  1.   

    包含一些定义的文件啊,如果你用vector,就#include <vector>....
      

  2.   

    同意楼上的.楼主多看看STL的书就可以了.使用起来很方便的.
      

  3.   

    如果我要用stirng,我应该包含哪个头文件?
      

  4.   

    我包含了,但是还是不行。还是出现error C2065: 'string' : undeclared identifie
    source code:
    #include <iostream.h>
    #include <windows.h>
    #include "string"
    void main() { 
      string s(10u, ' ');           // Create a string of ten blanks.  const char* A = "this is a test";
      s += A;
      cout << "s = " << (s + '\n');
      cout << "As a null-terminated sequence: " << s.c_str() << endl;
      cout << "The sixteenth character is " << s[15] << endl;
      
      reverse(s.begin(), s.end());
      s.push_back('\n');
      cout << s;
    }
      

  5.   

    首先确实是使用标准的C++模式
    自己定义一个容器类,有时容器类需要自己写,才可调用STL看看C++ STL吧