请问怎样做才能使用STL中的类和方法?
请问怎样做才能使用STL中的类和方法? 问题点数:20、回复次数:8Top
1 楼numen27(影子)回复于 2005-04-01 12:53:12 得分 5
包含一些定义的文件啊,如果你用vector,就#include <vector>....Top
2 楼4inSky(漂在深圳的程序员)回复于 2005-04-01 13:02:19 得分 0
同意楼上的.
楼主多看看STL的书就可以了.使用起来很方便的.Top
3 楼1981liliu(ll)回复于 2005-04-01 13:05:50 得分 0
如果我要用stirng,我应该包含哪个头文件?Top
4 楼xuzheng318(忧郁王子)回复于 2005-04-01 13:07:53 得分 0
windows.hTop
5 楼oyljerry(【勇敢的心】→ ㊣提拉米苏√㊣)回复于 2005-04-01 13:13:46 得分 5
#include "string"Top
6 楼1981liliu(ll)回复于 2005-04-01 13:21:12 得分 0
我包含了,但是还是不行。还是出现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;
}Top
7 楼hiiiiiijiang(等待毕业)回复于 2005-04-11 12:56:40 得分 5
using namespace std;Top
8 楼fvan(RainVan)回复于 2005-04-11 13:08:43 得分 5
首先确实是使用标准的C++模式
自己定义一个容器类,有时容器类需要自己写,才可调用STL
看看C++ STL吧Top
相关问题
- smarttemplate模板类如何才能使用use_cache方法?
- 菜鸟问题,怎样才能让基类调用派生类方法
- STL中有没有类似于MFC中CString中的format方法?
- 求STL的string类一些最常用的方法。
- 在类的构造函数里初始化的变量,怎样才能让类中的方法调用啊?
- STL容器能否包含多态类型,如果可以的话,怎样才能做到安全有效?
- 类方法,对象方法
- STL中的find方法的使用
- 在AWT里边怎样才能缩放图片,我用的Component,Image类,使用resize()方法不好用啊。求助。。。。。。
- structs框架中action类中的execute方法中的抛出的错误怎样才能让<html:messages />标记捕获到!?多谢!




