自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(53)
  • 资源 (3)
  • 收藏
  • 关注

原创 容器操作4 容器的大小

#include #include #include #include using namespace std;int main(){ list ilist; ilist.push_back(100); ilist.push_back(200); ilist.push_back(300); cout << "容器数据的个数:" << ilist.size() << e

2016-02-29 14:34:27 530

原创 顺序容器3关系运算符

#include #include #include #include using namespace std;class Dog{ // 成员省略 // 必须有 >, >=,<,<=,==,!=};int main(){ vector ivec1; vector ivec2; vector dog1; vector dog2; ivec1.push_b

2016-02-29 14:09:12 295

原创 顺序容器操作2 在顺序容器中添加元素

#include #include #include #include #include using namespace std;int main(){ vector svec; list slist; deque sdeq; svec.push_back("xiao"); svec.push_back("cui"); svec.push_back("ai");

2016-02-28 22:03:01 203

原创 顺序容器的操作1

#include #include #include #include using namespace std;int main(){ vector a; list b; deque c; a.push_back(1); a.push_back(2); a.push_back(3); for (vector::size_type i = 0; i < a.size

2016-02-28 21:01:58 197

原创 迭代器2

#include #include #include using namespace std;vector::iterator findInt(vector::iterator beg, vector::iterator end, int ival){ while (beg != end) if (*beg == ival) break; else ++beg;

2016-02-28 19:53:18 190

原创 迭代器

#include #include #include #include using namespace std;bool findInt(vector::iterator beg, vector::iterator end, int ival);int main(){ vector a; a.push_back(5); a.push_back(10); a.push_b

2016-02-28 19:16:22 192

原创 迭代器

#include #include #include #include using namespace std;int main(){ vector a; deque b; list c; a.push_back(1); a.push_back(2); a.push_back(3); vector::iterator iter1 = a.begin(); vec

2016-02-28 18:55:26 155

原创 顺序容器

#include #include #include #include #include "Dog.h"#include "Cat.h"#include using namespace std;int main(){ vector svec;// 默认的构造函数, svec.push_back("hello"); svec.push_back("C++"); svec

2016-02-28 13:50:35 167

原创 优先级队列priority_queue

#include #include // 优先级队列也在这里边,#include using namespace std;int main(){ //priority_queue> pq3; priority_queue pq; // 最大值优先级队列,默认的是vector类, //priority_queue,greater> pq2;

2016-02-28 11:27:46 313

原创 queue队列

#include #include #include #include using namespace std;int main(){ queue> a; queue> b; //队列没有迭代器,堆栈也没有迭代器,不能修改队列中的数据, queue q; //这个是默认的deque类, queue插入数据是在队尾插入,删除数据是在队首

2016-02-28 10:47:18 178

原创 stack栈

#include #include #include #include using namespace std;int main(){ stack> a; //a是deque类的堆栈, stack> b; stack> c; stack d; // d是默认的deque类的堆栈,堆栈是后进先出, d.push(2); d.push(1

2016-02-27 21:08:50 170

原创 list类3

#include #include using namespace std;void PrintListContents(const list& listInput);int main(){ std::list a; a.push_front(5); a.push_front(8); a.push_front(0); PrintListContents(a); a

2016-02-26 21:54:20 220

原创 list类2

#include #include using namespace std;void PrintListContents(const list& listInput); int main(){ std::list a; // 创建一个list, a.push_front(4); a.push_front(3); list::iterator iElementValue

2016-02-26 21:44:23 237

原创 list类

#include #include using namespace std;void PrintListContents(const list& listInput);int main(){ list a; list b; std::list::iterator iter; b.push_back(100); b.push_back(200); PrintList

2016-02-26 21:15:19 251

原创 deque向量

#include #include #include // 算法的头文件,int main(){ using namespace std; deque a; a.push_back(2); a.push_back(3); a.push_front(4); for (size_t nCount = 0; nCount < a.size(); ++nCount) {

2016-02-24 20:30:05 176

原创 字符串流2

#include #include #include #include using namespace std;int main(){ string fileName, s; vector svec; istringstream isstream; string word; fileName = "book1.txt"; ifstream inFile(file

2016-02-23 20:09:13 215

原创 字符串流

#include #include #include using namespace std;int main(){ // cout是流对象,ostream cout << "hello: " << endl; // ofs是文件输出流对象, ofstream ofs("test.txt"); ofs << "hello:" << endl; ofs.close();

2016-02-23 20:08:39 247

原创 open_file

#ifndef _GET_ H#define _GET_ H#include std::istream& get(std::istream& in);#endif#include "get.h"std::istream& get(std::istream& in){ int ival; while(in >> ival, !in.eof()) {

2016-02-23 19:09:27 863

翻译 文件流对象的使用

#include #include #include using namespace std;int main(){ string s; //ifstream ifs("file1.txt", ifstream::in);//这是文件模式, ifstream ifs("file1.txt"); // 这是默认的文件模式, ifs >> s; ifs.close()

2016-02-23 14:09:39 538

原创 IO库的举例

#include #include #include #include using namespace std;int fileToVector(string fileName, vector& svec){ ifstream inFile(fileName.c_str()); if (!inFile) return 1; string s; //while (get

2016-02-23 13:26:55 171

原创 流对象的使用2

#include #include #include #include using namespace std;void process(string s){ cout << s << endl;}int main(){ vector files; files.push_back("one.txt"); files.push_back("two.txt"); fi

2016-02-22 21:20:58 199

翻译 文件流对象的使用

#include #include // 文件流,#include using namespace std;int mian(){ ofstream outfile("test.txt"); //创建一个新的文件, outfile << "hello file? "; // 将hello file 写入到text.txt文件中, outfile.close(); //

2016-02-22 21:03:09 620

原创 条件状态2

#include using namespace std;int main(){ int sum = 0, value; while (cin >> value, !cin.eof()) { if (cin.bad()) throw std::runtime_error("IO stream corrupted"); // 抛出异常, if (cin.fail())

2016-02-22 20:30:24 174

翻译 条件状态

#include using namespace std;void check_cin_state(istring &is){ cout << "检查cin的状态:" << endl; if (cin is.bad()) cout << "cin bad()" << endl; else cout << "cin not bad()" << endl; if (cin i

2016-02-22 20:18:59 279

原创 标准IO库

#include #include #include using namespace std;void print(ofstream &of) // 传参数只能传引用或指针,{ cout << "test!" << endl;}//ofstream &print(ofstream &of)//{// cout << "test!" << endl;// ofstream

2016-02-22 19:48:54 253

原创 指向函数的指针

#include #include #include using namespace std;typedef bool (*cmpFcn) (const string&, const string&);// typedef简化指针的定义,bool lengthCompare(const string &s1, const string &s2){ return s1.size()

2016-02-22 14:20:55 228

原创 重载确定2

#include using namespace std;enum Tokens //定义枚举常量,{ INLINE = 128, VIRTUAL = 129};void ff(Tokens t) { cout << "ff(Tokens t)" << endl;}void newf(unsigned char x) { cout << "newf(unsigned char

2016-02-22 13:45:18 207

原创 重载确定

#include using namespace std;void f(){cout << "f()" << endl;}void f(int a) {cout << "f(int a)" << endl;}void f(int a, int b) {cout << "f(int a, int b)" << endl;}void f(double a, double b = 3.11

2016-02-22 13:10:52 212

原创 重载函数2

#include #include using namespace std;void print(const string &); // 函数声明,重载函数,void print(double); // 函数声明,重载函数,void print(int); // 函数声明,重载函数,void fooBar(int ival){ // 发生函数隐藏, // void

2016-02-22 12:50:30 269

原创 重载与作用域

#include #include using namespace std;string init() // 定义一个函数,{ return "hello";}void fcn(){ //int init = 0; // 变量名init和上面的函数名init将上面的string屏蔽了,这就出错了, string s = init(); cout << s << e

2016-02-22 12:35:55 515

原创 函数重载

#include #include using namespace std;class Account{};class Phone{};class Name{};class Record{public: Account a; Phone b; Name c;};void lookup_account(const Account& acct)//void

2016-02-22 12:25:26 202

原创 类的构造函数2

#include #include using namespace std;class Dog{public: int 数量; string 名称;};// Dog a ; // 创建对象a,这是一个全局对象默认初始化为int 为0,string类为空字符串,int main (){ cout << "Hello" << endl; // Dog a; //

2016-02-21 21:50:59 157

原创 类的构造函数

#include using namespace std;class Person{public: // 默认的构造函数, Person():钱(0) //这里的钱是变量,(0)对变量初始化, { // 可以空着, }public: int 钱;};int main (){ //”a和他“都是对象,原来没有这两个对象, Person

2016-02-21 21:43:20 153

原创 类的成员函数

#include #include using namespace std;class Sales_item // class要变成对象才能用,{public: double avg_price() const; // 函数原型声明, bool same_isbn(const Sales_item &rhs) const // 公有类的成员函数有const则不能变, {

2016-02-21 21:30:01 214

原创 内联函数

#include #include using namespace std;inline int sum (int a, int b)//内联函数放到头文件中,{ return a + b;}inline const string &shortString(const string &s1, const string &s2)//内联函数放到头文件中,{ return s

2016-02-21 20:54:00 168

原创 函数声明

#include using namespace std;// 函数声明,void print(int *arr, int size); // 等于viod print(int *, int);函数声明放在头文件中,需要使用的地方包含头文件,int main (){ int m[] = {0,1,2,3,4,5,6,7,8,9}; print(m, 10); return

2016-02-21 20:32:28 216

原创 递归计算阶乘

#include using namespace std;//void doA()//{// cout << "Hello" << endl;// doA();//}long 阶乘(int n){ if(n == 0) return 1; else return n * 阶乘(n - 1);}long 阶乘2(int n) // 循环计算阶乘,{

2016-02-21 20:12:56 403

原创 return 2

#include #include #include using namespace std;char &get_val(string &str, string::size_type ix){ return str[ix];}int main (){ string s("hello"); char& c = get_val(s,1); c = 'i';

2016-02-21 19:57:12 614

原创 return 语句

#include using namespace std;void do_a(){ cout << "b" << endl; cout << "bb" << endl; // return; // 提前return,return就是结束, cout << "bbb" << endl;}//void表示返回值是void,void返回值就是没有返回值,void swap(int

2016-02-21 13:55:05 239

原创 main 函数

#include using namespace std;//int main(int argc, char **argv) // 命令行选项,前边是个数,后边是字符转数组,每一个选项是一个字符串,//{// cout << argv[0] << endl; // argv[0]不是命令行选项,// cout << argv[1] << endl;// cout << argv[2

2016-02-21 13:36:59 173

掩膜版(opencv)

可以通过掩模矩阵(通常来讲叫核)对图像的每个图像像素值重新计算。这个掩模板能够调整临近像素包括当前像素对新像素的影响程度。从数学的角度来讲,我们用特殊的值对当前的值做了一个加权平均的操作。

2018-12-14

使用at、iterator、指针将颜色种类的缩减,进行比较

像素的颜色空间缩减、查找表、遍历像素的三种方式、程序计时等,比较每种方法的优缺点,现在用一个综合型的程序进行对比。

2018-12-13

迭代器iterator在opencv中使用

迭代器iterator可以很方便的遍历所有元素。Mat类支持迭代器的方式对矩阵元素进行遍历。由于使用迭代器就不需要再使用行列数进行操作。

2018-12-12

空空如也

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

TA关注的人

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