2021年4月27日

摘要: c++(vector容器 和几种常用的迭代器遍历方法) #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> #include <algorithm> #include <string> using namespa 阅读全文
posted @ 2021-04-27 14:27 lodger47 阅读(2158) 评论(0) 推荐(0)
摘要: 其实我是一个想法挺多的一个男人,或者男孩,为什么这么说呢?我不止一次觉得,每个人对待成熟这个词的定义,都不大相同。我有一个坚持了好几年的想法,也有陆陆续续实践过,那就是学好一门外语,起初,作为一个以成绩倒数为荣的超级大学渣,现在也深感学习的好,上学时最烂的就是英语,恰巧,英语使我的语文组词能力变得略 阅读全文
posted @ 2021-04-27 00:43 lodger47 阅读(55) 评论(0) 推荐(0)
摘要: 文件读写操作「c++」 #include <fstream> void test01() { //ofstream ofs("./test.txt",ios::out | ios::trunc); //后期指定打开方式 ofstream ofs; ofs.open("./test.txt",ios: 阅读全文
posted @ 2021-04-27 00:35 lodger47 阅读(100) 评论(0) 推荐(0)

2021年4月26日

摘要: C++(I/O流) 标准I/O: 对系统指定的标准设备的输入和输出。即从键盘输入数据,输出到显示器屏幕。这种输入输出成为标准的输入输出,简称标准I/O 文件I/O: 以外部磁盘文件为对象进行输入和输出,即从磁盘文件输入数据,数据输出到磁盘文件,以外存储文件为对象的输入输出称为文件的输入输出,简称我文 阅读全文
posted @ 2021-04-26 18:20 lodger47 阅读(84) 评论(0) 推荐(0)
摘要: C++(自带异常,自定义异常类继承系统的异常示例) #include <stdexcept> using namespace std; class MyOutOfRangException :public exception { public: MyOutOfRangException(string 阅读全文
posted @ 2021-04-26 18:02 lodger47 阅读(145) 评论(0) 推荐(0)
摘要: C++(自带异常,使用示例) #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <string> //系统提供标准异常 #include <stdexcept> using namespace std; class Person 阅读全文
posted @ 2021-04-26 17:35 lodger47 阅读(97) 评论(0) 推荐(0)
摘要: C++(自带异常) 头文件是#include <stdexcept> 异常名称 描述 exception 所有标准异常类的父类 bad_alloc 当operator new and operator new[],请求分配内存失败时 bad_typeid 使用typeid操作符,操作一个NULL指针 阅读全文
posted @ 2021-04-26 17:26 lodger47 阅读(73) 评论(0) 推荐(0)
摘要: C++(自定以异常类) class myException //自定以异常类 { public: void printError() { cout << "自定以异常类" << endl; } }; int myDevide(int a, int b) { if (b == 0) { throw m 阅读全文
posted @ 2021-04-26 16:26 lodger47 阅读(35) 评论(0) 推荐(0)
摘要: C++(异常) int myDevide(int a, int b) { if (b == 0) { //throw - 1;//抛出int类型异常 throw 3.13; } return a / b; } void test01() { int a = 10; int b = 0; try { 阅读全文
posted @ 2021-04-26 16:12 lodger47 阅读(34) 评论(0) 推荐(0)
摘要: C++(template模板 && 类模板 碰到有元函数类外实现) 类模板,碰到有元函数类内实现 #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <string> using namespace std; //让编译器提前看到 阅读全文
posted @ 2021-04-26 13:40 lodger47 阅读(68) 评论(0) 推荐(0)

导航