c++
NiceComputer
这个作者很懒,什么都没留下…
展开
-
c++ String
string 构造函数 构造函数 描述 string(const char* s) 将string对象初始化为s指向的字符串 string(size_type n,char c) 将string对象初始化为n个c string(con...原创 2019-07-08 11:18:43 · 364 阅读 · 0 评论 -
CRC x8 + x2 + x + 1校验
参考:https://blog.csdn.net/liwei16611/article/details/86704451(这位大哥写的挺好的,大家可以优先学习)手册中的参数定义:本实验采用以上CRC标准。#include <iostream>using namespace std;unsigned char crc_8(unsigned char* const ...原创 2019-09-25 22:21:57 · 1951 阅读 · 0 评论 -
C++ hash模板
#include <iostream> #include <unordered_set>#include <string>#include <functional>using namespace std;class Customer {public: std::string fname, lname; double sour; ...原创 2019-08-11 16:52:40 · 1235 阅读 · 0 评论 -
使用queue实现stack
class MyStack {public: /** Initialize your data structure here. */ MyStack() { input = new queue<int>(); output = new queue<int>(); } /** Push ele...原创 2019-08-19 08:22:36 · 625 阅读 · 0 评论 -
//含有initializer_list的构造函数
//Initialization_list #include <iostream>#include <string>using std::initializer_list;using namespace std;//含有initializer_list的构造函数template <typename Type> class Init{public...原创 2019-07-17 09:47:50 · 513 阅读 · 0 评论 -
c++ 仿函数
仿函数:解释:让一个类在使用时像一个函数。实现:在类中进行操作符重载()约束:重载操作符()时,编写参数个数一定要跟调用时一致(for_each()函数中使用一个参数的仿函数,所以在编写class:show中重载()时 和 show_more_than()时只有一个参数)。使用仿函数:通过类声明的对象(一般用临时对象),在创建对象时传参,参考下面代码块1定义仿函数#inc...原创 2019-07-13 17:18:27 · 127 阅读 · 0 评论 -
Template 具体化
具体化分为: 全部具体化 部分具体化 个数具体化:指定模板中某个参数的类型 范围具体化:参数代表数据类型、数据类型的指针 一定要注意下面的代码全部具体化什么叫具体化。个人认为:声明对象指定某一具体的类型,选用具体的 class 或者 struct#include <iostream>#include <string>//先定义...原创 2019-07-09 10:28:51 · 170 阅读 · 0 评论 -
C中的指针种种分类
1.指针常量2.常量指针3.指针数组:一个成员变量为指针的数组。4.数组指针5.函数指针:一个函数返回的数值类型为指针。6.指针函数:一个指针指向一个函数。定义方法: int (*p)()...原创 2019-07-02 21:40:32 · 297 阅读 · 0 评论 -
使用c++ ,重写运算符,编写complex方法
#ifndef _COMPLEX_ //防卫式声明 ,预防头文件重复声明 ,名字自己写的 #define _COMPLEX_ #include<iostream>using namespace std; class complex { private : int re,im; public : //1.注:1与2不可同时存在,因为在声明变量不输入参数时,对...原创 2018-05-15 20:04:19 · 1618 阅读 · 2 评论 -
侯捷推荐的书单
参考文章:https://blog.csdn.net/liu1064782986/article/details/7325632转载 2019-05-21 09:00:05 · 238 阅读 · 0 评论 -
C++ 文件简单操作:fstream ifstream
#include<fstream>简介:相当于cout,cout是库开发人员已经写好的对象,这里操作需要声明自己的ofsteream对象常用函数:open()用来打开指定的文件,可以通过is_open()判断是否打开成功is_open();用来判断单开文件是否成功,成功返回true,发欧泽返回falsegood();在没有发生任何错误的情况下返回true,否...原创 2019-06-01 10:56:41 · 924 阅读 · 0 评论 -
c++计时
使用方法:template <typename T>void meansure(T&& func){//应用用来计时的命名空间,该命名空间包含在std中using namespace std::Chrono;//开始计时auto start = system_clock::now();duration<double> diff = sy...原创 2019-10-10 21:44:39 · 374 阅读 · 0 评论