自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 break 语句

#include #include #include //定义时间的,using namespace std;int main (){ vector vec; srand((unsigned)time(NULL)); for(int i = 0; i < 10000; ++i) vec.push_back(rand() % 101); c

2016-01-22 17:15:33 172

原创 continue

#include #include #include //判断大小写,using namespace std;int main (){ string word; cout << "Enter some words: (Ctrl+Z to end) " << endl; while(cin >> word) { if(islower(word[0])

2016-01-22 17:14:35 181

原创 do while 2

#include #include using namespace std;int main (){ string rsp; do{ cout << "Please enter two values: "; int i, j; cin >> i >> j; cout << "The sum of " << i << " + " << j << " = "

2016-01-22 16:24:33 207

原创 do while

#include using namespace std;int main (){ int i = 10; while(i < 5) { cout << "i: " << i << endl; ++i; } cout << "\n 上边是i,下边是j \n" << endl; int j = 10; do {

2016-01-22 16:22:54 187

原创 for循环判断两个向量对应数是否相等

#include #include using namespace std;int main (){ vector ivec1, ivec2; int ival; cout << "Enter elements for the first vector: (Ctrl+Z to end)" << endl; /*cin >> ival; while(ival != 32

2016-01-22 15:18:48 1010

原创 for循环

#include #include #include using namespace std;int main (){ // 第一部分; 条件;表达式 for(int i = 0; i < 10; ++i) { cout << i; cout << endl; } vector svec; svec.push_back("I

2016-01-22 15:16:48 239

原创 while 循环3

#include#includeusing namespace std;int main (){ string preWord, currWord; string repWord; int currCnt = 0,maxCnt = 1; cout << "Enter sone words(Ctrl+Z to end): " << endl; while(cin >>

2016-01-21 15:36:24 410

原创 while 循环2

#includeusing namespace std;int main (){ int arr1[] = {2,52,16,40,5,0,6,8,9,4,7}; int *source = arr1;//arr1是指的数组的第一个元素, size_t s = sizeof(arr1)/sizeof(*arr1);//s 代表的是数组的数目, int *dest = new

2016-01-21 15:35:52 287

原创 while 循环

#includeusing namespace std;int getNumber()//这是定义一个变量,{ int num; cout << "请输入一个数做循环次数(输入0结束):"; cin >> num; return num;}int main (){ int i = 0; while(i < 5) cout << i++ << endl

2016-01-21 15:35:19 237

原创 switch语句2

#includeusing namespace std;int main (){ char ch; int aCnt = 0,eCnt = 0,iCnt = 0,oCnt = 0,uCnt = 0; int otherCnt = 0; while(cin >> ch) { switch(ch) { case 'A': case

2016-01-21 12:48:32 304

原创 switch语句

#includeusing namespace std;int main (){ int i; cout << "今天星期几:"; cin >> i; switch(i) // 输入几将后边的都输出出来,贯穿所有,除非将后边加上break; 就不会发生贯穿了, { case 1: //case 后边必须是整数,case默认的判断就是等于, cout << "s

2016-01-21 12:46:54 412

原创 if语句

#include#includeusing namespace std;int compute_value(){ return 6;}int main (){ // int a = 1;//一个逗号就是一个语句, for(int b = 0; b < 10; ++b) { // 块语句,空块 } for(int i

2016-01-21 10:35:32 247

原创 强制类型转换符

#include#includeusing namespace std;class CAnimal{public: virtual void Speak() = 0;};class CCat : public CAnimal //继承了CAnimal,{public: void CatchMice() { cout << "Cat: I caught a mouse!

2016-01-20 16:39:43 258

原创 sizeof和条件操作符

#includeusing namespace std;int main (){ int val1,val2,val3; int min,max; cout << "Enter two integers:" << endl; cin >> val1 >> val2; //if(val1 < val2) //min = val1; //else

2016-01-19 14:07:42 216

原创 箭头操作符2

#includeusing namespace std;class Dog{ public: void foo() { cout << "Hello ni hao " << endl; }};int main (){ Dog d; d.foo();// 输出的是 Hello ni hao Dog *p; p = new Do

2016-01-19 12:36:19 176

原创 箭头操作符

#include#include#includeusing namespace std;int main (){ vector spvec; string str; cout << "Enter some strings(Ctrl+Z to end)" << endl; while(cin >> str) { string *pstr = new

2016-01-19 12:35:25 273

原创 赋值操作符

#includeusing namespace std;int main (){ int a; a = 9; // 赋值,不是等于 int j,k; double p; p = k = 2.1; cout << p << ", " << k << endl;//输出的是p为2,k为2, k = p = 2.1; cout << p << ", " << k <

2016-01-18 21:05:24 234

原创 位操作符2

#include#includeusing namespace std;int main (){ // 八进制 unsigned char bits = 0227; //10010111,char取8位字节,这个数的十进制是151 bits = ~bits; //01101000,这个数的十进制是104, co

2016-01-18 20:14:03 229

原创 位操作符

#include#includeusing namespace std;int main (){ bitset a;// unsigned long b = 0; a.set(25);//点set是将其变成1 //000000000000000000000000000001 //000100000000000000000000000000 b |= (

2016-01-18 20:13:12 296

原创 操作符

#include#includeusing namespace std;int main (){ int val; vector vec; //cin >> val; while(cin >> val && val != 42)//利用短路求值判断,左边的为false时,右边的就不用计算了, { //cin >> val; vec.push_ba

2016-01-18 18:52:13 182

原创 多维数组

#includeusing namespace std;typedef int int_array[4];int main (){ const size_t rowSize = 3; const size_t colSize = 4; int ia[rowSize][colSize] = { {0,1,2,3}, {4,5,6,7}, {8,9,10,11}

2016-01-18 13:02:13 175

原创 新旧代码的兼容3

#include #include #include using namespace std;int main (){ vector sevc; string str; cout << "Enter strings: (Ctrl+Z to end)" << endl; while(cin >> str)//这里输入的就是一个字符一个字符的输入的, sevc.p

2016-01-18 12:00:45 230

原创 新旧代码的兼容2

#include #include #include using namespace std;int main (){ vector ivec; int ival; cout << "Enter numbers: (Ctrl+Z to end)" << endl; while(cin >> ival) ivec.push_back(ival); int *pa

2016-01-18 11:59:53 205

原创 新旧代码的兼容1

#include #include #include using namespace std;int main (){ string st("Hello World"); // C风格的字符串, st = st + " bill "; cout << st << endl; const char *str = st.c_str();//点c_str是指向常字符

2016-01-18 11:57:57 247

原创 动态数组2

#include #include using namespace std;int main (){ const char *pc = "xiao cui ai ni"; const size_t len = strlen(pc); for(size_t i = 0; i != 100; ++i) { char *pc2 = new char[len +

2016-01-15 09:37:27 147

原创 动态数组1

#include #include using namespace std;int main (){ int a[10]; //静态数组,堆栈上创建的, int n; cout << "你想要多大的数组:" << endl; cin >> n; int *p = (int *)malloc(n * sizeof(int));// C语言创建动态数组

2016-01-15 09:36:37 298

原创 C风格字符串

#include #include #include using namespace std;int main (){ string s("xiao"); char s3[] = {'C','+','+'}; //C风格字符数组,有NULL才是字符串, char s4[] = {'C','+','\0'}; //C风格字符串, char s5[] =

2016-01-14 21:38:17 144

原创 指针和const

#include #include #include using namespace std;int main (){ double a = 0.1; double *p = &a; *p = 1.2; // 这个修改是可以的, const double pi = 3.14; // 这是一个常double, const doub

2016-01-14 20:15:28 178

原创 指针2

#include #include using namespace std;int main (){ int v1[] = {1,8,45,100,200}; // v1 是一个数组, int *xiao = v1; // 指针可以定义一个数组, cout << *xiao << endl; xiao = &v1[

2016-01-14 19:40:59 149

原创 指针

#include #include #include using namespace std;int main (){ string s("xiao cui ai ni ?"); string *sp = &s; //* 可以靠近变量来写,也可以靠近类型来写, //string* v1, v2; //v1是一个指针 v2就不是指针, co

2016-01-14 18:30:01 142

原创 数组

#include #include using namespace std;int zn[5];//zn 是函数外边的全局数组,不定义值,电脑初始化为0,数组可以使用,在函数内部不会对其进行初始化,unsigned get_size(){ int a = 100; int b = 200; return a+b;}int main (){ int a[100];

2016-01-13 09:47:29 169

原创 bitset查找质数

#include #include #include using namespace std;int main (){ int const max_number(1000000); int const max_test((int)sqrt((double)max_number)); // sqrt 是标准库函数cmath的头文件,sqrt是double类型的, bitset

2016-01-12 21:58:48 234

原创 bitset三

#include #include #include using namespace std;int main (){ bitset a; cout << a << endl; a[5] = 1; cout << a << endl; for(int index = 0; index != 32; index += 2) a.set

2016-01-12 13:37:57 174

原创 bitset二

#include #include #include using namespace std;int main (){ bitset a(132); cout << a << endl; bool is_set = a.any(); // any检查a里边至少有一个为1,则为true, if(is_set) cout << "a里边至少

2016-01-12 13:36:12 165

原创 bitset 一

#include #include #include using namespace std;int main (){ bitset a; //a 的类型就是bitset类型,尖括号<>里边是长度,a 的里是放32个二进制 位,a的大小是32位二进制,初始化为0, cout << a << endl; bitset b(0xffff); //

2016-01-12 13:35:12 353

原创 迭代器

#include #include #include using namespace std;int main (){ vector v(10,1);//10个1 //begin()操作返回一个迭代器, //begin()操作返回一个迭代器指向向量中的第一个数据元素, vector::iterator iter = v.begin();

2016-01-12 10:41:18 188

原创 vector(2)

#include #include #include using namespace std;int main (){string str;vector svec;cout << "Enter text(Ctrl+Z to end):" << endl;while(cin >> str)svec.push_back(str);if(svec.size() == 0)

2016-01-12 09:28:11 176

原创 vector(1)

#include #include #include using namespace std;int main (){int ival;vector ivec;cout << "Enter numbers(Ctrl+Z to end):" << endl;while(cin >> ival)ivec.push_back(ival);// 计算相邻的两个数之和if

2016-01-12 09:21:44 246

原创 vector

#include #include #include using namespace std;int main (){vector ivec; // ivec是空的,里面一个数都没有cout << ivec.size() << endl;cout << "请输入5个整数:" << endl;int k;for(vector::size_type i = 0; i !=

2016-01-11 21:28:16 148

原创 push_back的使用

#include #include #include using namespace std;int main (){vector v1;v1.push_back(10);v1.push_back(11);v1.push_back(12);vector v2(v1);vector v4(10,8);vector v6(8);//输出的是8个0,vector v

2016-01-11 21:26:13 1685

掩膜版(opencv)

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

2018-12-14

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

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

2018-12-13

迭代器iterator在opencv中使用

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

2018-12-12

空空如也

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

TA关注的人

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