自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 收藏
  • 关注

原创 JAVA網絡編程 TCP聊天室代碼保存

【代码】JAVA網絡編程 TCP聊天室代碼保存。

2022-12-26 02:05:09 103 1

原创 利用读写操作对文件进行复制

#include <iostream>#include <string>#include <fstream>eunm { LEN = 2048 };using namespace std;bool copy_file(const string& str,const str_c){ //打开文件 fstream in(str,ios::in|ios::binary); fstream out(str_C,ios::out|.

2021-02-23 11:28:53 344

原创 关于单例模式&和静态变量的特性

单例模式:: 只产生一个对象,且所有用户共用一个对象#include <iostream>using namespace std;class Single{public: //创建一个对外接口 static Single* Get_Instance() { return sg; }private: Single() {}; Single(const Single&) {}; static S...

2021-02-04 14:57:46 195

原创 2020-12-17 选择排序及其扩展(待完成

快速排序&泛型【快速排序】#include <iostream>using namespace std;void MySort(int a[], int b){ for (int i = 0; i < b; i++) { int _FLAG = i; for (int j = i + 1; j < b; j++) { if (a[j] < a[_FLAG]) { _FLAG = j; } } if (_FLA

2020-12-17 17:17:01 89

原创 关于函数指针做函数参数的运用(冒泡排序)

/*@OndO 练习利用函数指针做函数参数进行冒泡排序参考:https://zhuanlan.zhihu.com/p/37306637*/using namespace std;#include <iostream>//创建函数模板template <typename T>bool foo(const T a, const T b){ return (a < b);}template <typename T>bool foo_1(.

2020-11-20 10:56:47 366

原创 笔记:C++中using关键字的用法

命名空间using namespace std;给数据类型取别名void test(){ using unint = unsigned int; unint ref = 5; std::cout << ref << std::endl;}int main(){ test(); system("pause"); return 0;}在继承中重写某成员函数或成员变量的权限。class animal{public: std::string

2020-10-14 16:00:49 357

原创 观测Vector容器开辟内存次数

#include <iostream>#include <vector>#include <ctime>using namespace std;/*监测vector开辟内存次数*/void test(){ srand((unsigned int)time(NULL)); vector<int>v; int num = 1;//计数器 int* p = NULL; for (int a = 0; a < 92223; .

2020-10-14 00:10:11 119

原创 使用二元谓词对sort排序算法进行修改

什么是谓词:谓词概念:返回值是bool类型的仿函数;谓词根据形参分两种一元谓词和二元谓词;template<class T>class Myoperator{public: bool operator()(const T& a){} //一元谓词只持有a一个形参 bool operator()(const T& a,const T& b){} //二元谓词 持有a和b两个形参}sort默认算法是从小到大排序_STD sort

2020-10-09 23:37:57 382

原创 C++ 笔记 关于使用仿函数来修改set容器默认排序

set容器默认升序排序,如果需要降序排序则需要使用伪函数或者 greater<T>CODE部分:#include <iostream>#include <set>#include <ctime>#include <algorithm>using namespace std;class Mycompare{public: //注意!这里必须要写成常函数 bool operator()(const int& val

2020-10-05 18:08:49 388

原创 黑马C++基础练习《员工分类》采用 multimap&vector容器

项目要求:1:创建若干员工,赋初值。2:为每位员工分配相应的岗位。3:按照岗位分批输出人员信息。项目思路:创建员工类,并采用vector容器存储员工信息。由于multimap可以存储同一key值,故采用该容器。遍历vector容器析出*it(员工对象),并对其赋值(部门值)for(vector<Person>::iterator it = v.begin(); it != v.end(); it ++){ //multimap<int,Person&

2020-10-05 10:21:14 204

原创 黑马B站C++教程作业练习 《评委打分》

黑马B站C++教程作业练习 《评委打分》项目要求:创建若干选手,并用10名评委对其进行打分,去除一个最高分&最低分,取其平均分。项目思路创建一个选手类,使用vector容器进行存储,并使用deque容器进行打分,因为deque容器可以对头尾进行操作故使用该容器。pop_back();pop_front();代码部分????#include <iostream>#include <vector>#include <deque>

2020-10-04 01:05:35 254

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除