11 2013 档案

remove_if的问题
摘要:#include#include#include#include"PRINT_ELEMENTS.h"using namespace std;class Nth{ private: int nth; int count; public: Nth(int n):nth(n),count(0){ } bool operator()(int){ return ++count==nth; }};int main(int argc, char **argv){ list coll... 阅读全文

posted @ 2013-11-19 10:36 yi_meng 阅读(338) 评论(0) 推荐(0) 编辑

string 复制给char[] 即:c_str() 用法:
摘要:语法: const char *c_str();c_str()函数返回一个指向正规C字符串的指针, 内容与本string串相同. 这是为了与c语言兼容,在c语言中没有string类型,故必须通过string类对象的成员函数c_str()把string 对象转换成c中的字符串样式。注意:一定要使用strcpy()函数 等来操作方法c_str()返回的指针 比如:最好不要这样: char* c; string s="1234"; c = s.c_str(); //c最后指向的内容是垃圾,因为s对象被析构,其内容被处理应该这样用: char c[20]; string s=&qu 阅读全文

posted @ 2013-11-17 15:02 yi_meng 阅读(3582) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示