摘要: #include <iostream> using namespace std; char* mystrcpy(char* dest,const char* src) { if(src==nullptr || dest==nullptr) { return nullptr; } char* addr 阅读全文
posted @ 2022-03-26 14:03 菠萝超级酸 阅读(47) 评论(0) 推荐(0)
摘要: #include <iostream> #include <memory>//allocator using namespace std; class String { static allocator<char> alloc; private: char *start; char *first_f 阅读全文
posted @ 2022-03-26 13:59 菠萝超级酸 阅读(28) 评论(0) 推荐(0)
摘要: 错误提示1:undefined reference to `StrVec::alloc[abi:cxx11]' 类的静态数据成员需要在类外定义。 解决方式在类外加上代码: allocator<string> StrVec::alloc; 错误提示2:error: passing 'const Str 阅读全文
posted @ 2022-03-25 14:38 菠萝超级酸 阅读(247) 评论(0) 推荐(0)
摘要: #include <iostream> #include <vector> #include <string> #include <set> using namespace std; class Message; class Folder { friend class Message; privat 阅读全文
posted @ 2022-03-23 22:16 菠萝超级酸 阅读(44) 评论(0) 推荐(0)
摘要: //两个类实现文本查询 #include <iostream> #include <memory> #include <fstream> #include <vector> #include <string> #include <set> #include <map> #include <sstre 阅读全文
posted @ 2022-03-20 16:07 菠萝超级酸 阅读(130) 评论(0) 推荐(0)
摘要: istringstream报错,错误如下 :variable 'std::istringstream line_stream' has initializer but incomplete type istringstream line_stream(line); 解决方法:包含sstream头文件 阅读全文
posted @ 2022-03-13 15:05 菠萝超级酸 阅读(1330) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; class Base { public: Base():b(1){} virtual void fun(){}; int b; }; class Son:public Base { public: Son():d(2) 阅读全文
posted @ 2022-03-03 11:19 菠萝超级酸 阅读(88) 评论(0) 推荐(0)
摘要: #include <iostream> #include <vector> #include <stack> using namespace std; //有序数组去重 int order(vector<int> a) {//0-slow为去重后有序数组 int size=a.size(); int 阅读全文
posted @ 2022-02-10 14:21 菠萝超级酸 阅读(36) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; struct Node//定义单链表 { int val; Node* next; Node(int _val):val(_val),next(nullptr){} } ; class JoCycle{//定义环 pr 阅读全文
posted @ 2022-02-08 17:12 菠萝超级酸 阅读(24) 评论(0) 推荐(0)
摘要: #include <iostream> #include <string> using namespace std; int main(int argc, char *argv[]) { /* //法1,使用find函数 string st="1001,88.67,1003,22.1,1002,76 阅读全文
posted @ 2022-02-03 22:07 菠萝超级酸 阅读(872) 评论(0) 推荐(0)