请问怎样做才能使用STL中的类和方法? 请问怎样做才能使用STL中的类和方法? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 包含一些定义的文件啊,如果你用vector,就#include <vector>.... 同意楼上的.楼主多看看STL的书就可以了.使用起来很方便的. 如果我要用stirng,我应该包含哪个头文件? 我包含了,但是还是不行。还是出现error C2065: 'string' : undeclared identifiesource 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;} 首先确实是使用标准的C++模式自己定义一个容器类,有时容器类需要自己写,才可调用STL看看C++ STL吧 CMFCPopupMenu要怎么用呢? 高分求用OPENGL+VC实现的三维环境中模拟水流的例子 如何对Custom Draw进行处理? Gina相关问题? 看看这个动态链接怎么做 需要单击菜单弹出对话框,但是却报错(好像是内存读错误) 各位高手,谁知道那里有winIO的程序 有谁给个答案 求ocx制作过程 关于界面最大化时单选框出现的奇怪问题 读写注册表的问题 帮忙看看GetQueuedCompletionStatus的问题,谢谢
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;
}
自己定义一个容器类,有时容器类需要自己写,才可调用STL看看C++ STL吧