上一页 1 ··· 5 6 7 8 9 10 11 12 13 下一页
摘要: strcat_s函数原理:dst内存空间大小 = 目标字符串长度 + 原始字符串场地 + ‘\0’; 获取内存空间大小使用sizeof函数(获取内存空间大小);获取字符串长度使用strlen函数(查字符串长度 char src[1024] = { "C/C++教程-strcat_s函数" }; ch 阅读全文
posted @ 2024-09-22 16:11 zhongta 阅读(45) 评论(0) 推荐(0)
摘要: 1.flush 刷新缓存,endl刷新缓存并换行 cout<<"Hello"<<flush; cout<<"Wait<<endl; 2.hex,oct,dec 输出16进制,8进制,10进制 cout<<hex cout<<oct cout<<dec 3.使用width调节宽度 cout.width 阅读全文
posted @ 2024-09-01 13:54 zhongta 阅读(14) 评论(0) 推荐(0)
摘要: 1.迭代器种类 (1)input iterator (2)output iterator (3)forward iterator (4)bidirectional iterator (5)random access iterator 2.input iterator 信息从容器流入程序被称为输入,i 阅读全文
posted @ 2024-08-27 14:01 zhongta 阅读(12) 评论(0) 推荐(0)
摘要: 1.Smartpointer是指针类,会自动释放指针分配的空间 2.包括auto_ptr,shared_ptr,unique_ptr 3.使用方法 (1)包含#include (2)实例化 auto_ptr pd(new double); auto_ptr ps(new string); uniqu 阅读全文
posted @ 2024-08-26 18:44 zhongta 阅读(10) 评论(0) 推荐(0)
摘要: class Grand{}; class Superb:public Grand{}; class Magnificent:public Superb{}; Superb *pm=dynamic_cast<Superb *>pg; 如果类型转换成功返回Superb指针,不成功返回0 2.引用的动态转 阅读全文
posted @ 2024-08-22 14:29 zhongta 阅读(12) 评论(0) 推荐(0)
摘要: 1.abort() #include<cstdlib> abort()会刷新文件缓冲区,向标准错误流输出untenable arguments to hmean() 2.try catch 对象 class bad_hmean{ private: double v1; double v2; publ 阅读全文
posted @ 2024-08-21 14:51 zhongta 阅读(20) 评论(0) 推荐(0)
摘要: 1.友元类 class Tv{ public: friend class Remote; priavte: int volume; } class Remote{ public: bool volup(Tv &t){t.volume++;} } 2.友元函数 class Tv{ friend voi 阅读全文
posted @ 2024-08-20 15:20 zhongta 阅读(12) 评论(0) 推荐(0)
摘要: public Worker{}//基类 public Singer:public Worker{}//继承Worker public Waiter:public Wokrer{}//继承Worker public SingingWaiter:public Singer,public Waiter{} 阅读全文
posted @ 2024-08-16 13:54 zhongta 阅读(16) 评论(0) 推荐(0)
摘要: 1.初始化 double gpa[5]={3.1,3.5,3.8,2.9.3.3}; valarray<double> v1;//double数组,长度为0 valarray<int> v2(8);//int数组长度为8 valarray<int> v3(10,8);//int数组,每个元素值为10 阅读全文
posted @ 2024-08-14 15:08 zhongta 阅读(18) 评论(0) 推荐(0)
摘要: 1.构造函数不能定义为虚函数 2.析构函数应该定义为虚函数。 3.友元函数不应该被定义为虚函数。因为友元函数不是类的成员函数。 4.派生类函数重定义会覆盖基类的函数 class Dwelling{ public: virtual Dwelling &build(int n); }; class Ho 阅读全文
posted @ 2024-08-12 14:36 zhongta 阅读(18) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 11 12 13 下一页