自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 超大整数相加用字符串解决

#includeusing namespace std;#includechar* add1(char *a,char *b){ int c=0; int i=strlen(a)-1;//i,j分别表示最后的一位,,a[9],b[x] int j=strlen(b)-1; int k; int maxlenth=strlen(a)>=strlen(b)? strlen(a)

2016-07-25 12:22:21 1084

原创 无情链表的创建,,插入,,删除第一个位

#include#include#include#include//无情链表的创建,,插入,,删除第一个位using namespace std;typedef struct list{int data;struct list *next;}node;node *creat(){node *head,*p,*s;int x

2016-07-20 17:18:07 424

原创 选择排序--稳定

#includeusing namespace std;void swap(int &a,int &b){int ww=a;a=b;b=ww;}int main(){int temp,b;int a[]={7,2,4,8,5,6,9,1};for(int i=0;i{temp=a[i];b=i;for(int

2016-07-20 17:13:45 481

原创 整形转换成字符串

#includeusing namespace std;#includevoid int2str(int a,char *str){char b[10]="";int i=0;int len=0;while(a){b[i++]=a+'0';a=a/10;}len=i;str[i]=0;while(i){str[--i]=b

2016-07-20 17:12:41 456

原创 希尔排序--插值排序

#include#includeusing namespace std;  #include   #include int main(){ int   istart;         istart=GetTickCount();int a[]={2,4,6,1,7,5,9,8};int j;int len=8;for(int h=len/2;

2016-07-20 17:11:13 581

原创 快速排序

#includeusing namespace std;void swap(int &a,int &b){int t=a;a=b;b=t;}void quick_sort(int a[],int low,int high){int i,j,temp;temp=a[low];   i=low;   j=high;whil

2016-07-20 17:09:35 364

原创 蛇形数组4

#includeusing namespace std;int main(){ int n; cin>>n; //申请一维数据并将其转成二维数组指针 int **s = new int*[n]; for(int i=0;i<n;i++) { s[i] = new int[n]; } for(int i=0

2016-09-05 10:24:38 294

原创 蛇形数组3

#includeusing namespace std;int main(){ int n; cin>>n; //申请一维数据并将其转成二维数组指针 int **s = new int*[n]; for(int i=0;i<n;i++) { s[i] = new int[n]; } for(int i=0

2016-09-02 12:42:38 331

原创 蛇形数组2

#includeusing namespace std;int main(){ int n; cin>>n; //申请一维数据并将其转成二维数组指针 int **s = new int*[n]; for(int i=0;i<n;i++) { s[i] = new int[n]; } int num=1;

2016-09-02 12:07:47 318

原创 蛇型数组1

#includeusing namespace std;int main(){ int n=5; cin>>n; //申请一维数据并将其转成二维数组指针 int **s = new int*[n]; for(int i=0;i<n;i++) { s[i] = new int[n]; }

2016-09-02 11:20:12 331

原创 输出梯形列的数字

#includeusing namespace std;int main(){ int n; cin>>n; int m=0; int b; for(int i=1;i<=n;i++) { m=(i*i-i+2)/2; b=((i+1)*(i+1)-(i+1))/2; for(int j=1;j<=i;j++) { cout<<m; if(m<b

2016-08-31 14:50:10 609

原创 求两个数的不同位有多少个

int countBitDiff(int m, int n) { int c; c = m^n; int count = 0; while(c>0) { if(c%2==1) count++; c=c>>1; }

2016-08-30 16:29:11 338

原创 链表删除指定的值

#include #include #include #include using namespace std;typedef struct list{ int data; struct list *next;}node;node *del(node *head,int data){ node *p,*q; p=head; q=p; p=p->next;

2016-08-29 16:31:36 480

原创 出租车计费华为校招

#include#includeusing namespace std;int main(){ float n; int time; float result=0; float temp=0; cin>>n; cin>>time; if(n<=2&&time<10) { result=6.0; } else { int a=0; if(n<=7) {

2016-08-18 15:41:56 684

原创 华为校招 解析报文,找出字符段的输出

输入的是:char str[]="name=justin,age=18,gender=male,job=sew";输出 是: [[name,justin],[age,18],[gender,male],[job,sew]]#includeusing namespace std;int main(){ //char str[]="name=justin,age=18,gender=ma

2016-08-18 14:48:45 1070

转载 c++中类对象不能访问类的私有成员变量

c++中类对象不能访问类的私有成员变量 (2014-06-19 14:13:40)转载▼标签: 股票分类: C/C _Concept类的成员变量分三种: public   protect  private 1、类的成员函数可以访问类这三类2、继承类成员函数可以访问 protect  类型

2016-08-09 11:17:34 2656

原创 网易移动西瓜问题

有N个人,每个人有ai个苹果,需要将最后移动到所有人一样多,一次只能移动2个,不能就返回-1,问一共需要移动多少次呢?#include#includeusing namespace std;int main(){ int n; int a[100]; int total=0; int p=0;//记录是否为全鸡偶,p=1,则不是全鸡,全偶。 int coutnum=0

2016-08-02 21:54:59 379

原创 除数不能整除,向上取整

一种处理向上取整的方法若我们得到的两个数 a,b;如果a除以b为整数则 取 他们的整数,,6/3=2  取 2如果a除以b 有小数,我们就要向多的方向去取,,,5/3=1......但要取  2用向上取整的方法则 为      (a-1)/b+1还有一种  就是有间隔的,,比如 一首歌的长度为s,没首歌间隔为  1 ,,cd容量 为L....则cd最多可以放几首

2016-08-02 12:34:57 1872

原创 数字黑洞6174

给定一个任意不完全相同的4位数,列如6767则7766-6677=10899810-0189=96219621-1269=83528532-2358=6174#includeusing namespace std;void dd(int n) { int a,b,c,d; a=n%10; b=n/10%10; c=n/1

2016-08-02 10:49:44 3091

原创 二维指针

下面程序的输出结果是1234567#includevoid main(){ int n[][3] = {10,20,30,40,50,60}; int (*p)[3]; p=n; cout<<p[0][0]<<","<<*(p[0]+1)<<(*p)[2]<<endl;}nt (*p)[3];这里首先确定:p是一个指针,一个指向数

2016-08-01 20:31:14 491

原创 [编程题] 小易的升级之路

小易经常沉迷于网络游戏.有一次,他在玩一个打怪升级的游戏,他的角色的初始能力值为 a.在接下来的一段时间内,他将会依次遇见n个怪物,每个怪物的防御力为b1,b2,b3...bn. 如果遇到的怪物防御力bi小于等于小易的当前能力值c,那么他就能轻松打败怪物,并 且使得自己的能力值增加bi;如果bi大于c,那他也能打败怪物,但他的能力值只能增加bi 与c的最大公约数.那么问题来了,在一系列的锻炼后,小

2016-08-01 15:41:14 379

原创 substr 复制字符串

#include#includeusing namespace std;main(){string s("12345asdf");string a=s.substr(0,4); //获得字符串s中 从第0位开始的长度为4的字符串cout<<a<<endl;}输出结果为:1234

2016-08-01 15:00:56 276

原创 盐水问题

题目描述挂盐水的时候,如果滴起来有规律,先是滴一滴,停一下;然后滴二滴,停一下;再滴三滴,停一下...,现在有一个问题:这瓶盐水一共有VUL毫升,每一滴是D毫升,每一滴的速度是一秒(假设最后一滴不到D毫升,则花费的时间也算一秒),停一下的时间也是一秒这瓶水什么时候能挂完呢?#include"iostream"using namespace std;int mai

2016-08-01 14:47:11 540

原创 字符串中封装好的函数

http://www.kuqin.com/clib/string/strstr.html

2016-07-27 13:16:03 276

转载 vs中添加界面皮肤

SkinSharp又称Skin#,是Windows环境下一款强大的换肤组件。SkinSharp作为换肤控件,只需要在您的程序中添加一行代码,就能让您的界面焕然一新,并拥有多种主题风格和色调的动态切换功能以及Vista透明边框特效。网站地址:http://www.skinsharp.com/官方下载:http://www.skinsharp.com/htdocs/tar/Sk

2016-07-27 13:10:24 2165

原创 统计字符串中0和1出现最多的个数

#includeusing namespace std;int findmax(char *a){ char *p=NULL; p=a; int cout0=0; int cout1=0; int temp0=0;//最后保存0的个数 int temp1=0; while(*p!=NULL) { if(*p=='0') { cout0++; if(*(

2016-07-27 10:57:56 784

原创 字符串中单词的翻转(二)

#includeusing namespace std;#includevoid swap(char *a,char *b)//交换每个字符{ char temp=*a; *a=*b; *b=temp;}//void swapword(char *a,int n,int m)//交换每个单词//{//// for(int i=0;i<=(m-n)/2;i++)// {

2016-07-23 10:59:58 250

原创 数据类型所佔用内存大小&nbsp;(200…

数据类型所佔用内存大小 (2007-06-1916:55:08)(2007-06-19 16:55:08)" TITLE="数据类型所佔用内存大小 (2007-06-19 16:55:08)" />转载▼分类: 操作系统    一般根据不同的操作系统,其数据类型的表示也不尽相同.如果在机器字长位16的机器上编译,可能int只有2个byte,在字长32的机

2016-07-23 10:27:37 330

原创 MFC&nbsp;中WM_消息处理对应的处理函数

ON_WM_ACTIVATE( ) afx_msg void OnActivate( UINT, CWnd*,BOOL) ON_WM_ACTIVATEAPP( ) afx_msg void OnActivateApp( BOOL,HANDLE) ON_WM_ASKCBFORMATNAME( ) afx_msg void OnAskCbFormatName( UINT,LPSTR) ON

2016-07-23 10:27:35 3149

原创 C/C++&nbsp;中fopen_s与fopen

fopen函数 fopen("文件名","打开方式")、FILE *fopen( const char*filename, const char *mode );      r 打开只读文件,该文件必须存在。r+ 打开可读写的文件,该文件必须存在。rb+读写打开一个二进制文件,只允许读写数据。rt+ 读写打开一个文本文件,允许读和写。      w打开只写文件,若文件存在则文件

2016-07-23 10:27:32 1981

原创 字符串的循环移位m位

#includeusing namespace std;#includevoid swap(char &a,char &b)//交换每个字符{ char temp=a; a=b; b=temp;}void swapword(char a[],int n,int m)//交换指定的n,m间的位{ while(n<m) { swap(a[n++],a[m--]);

2016-07-22 17:32:25 293

原创 字符串中单词的交换与单词翻转(一)

#includeusing namespace std;#includevoid swap(char *a,char *b)//交换每个字符{ char temp=*a; *a=*b; *b=temp;}void swapword(char *a,int n,int m)//交换每个单词{ for(int i=0;i<=(m-n)/2;i++) { swap(a+n

2016-07-22 16:41:15 803

原创 逆序输出字符串

#includeusing namespace std;#includevoid swap(char *a,char *b){ char temp=*a; *a=*b; *b=temp;}int main(){ char s[]="I am a student"; int len=strlen(s); for(int i=0;i<len/2;i++) { swap

2016-07-22 15:33:10 205

原创 字符串中查找子字符串的位置

#includeusing namespace std;#includeint strfindstr(char * des, char *sub){ assert(des!=NULL&&sub!=NULL); const char *bp; const char *sp; int temp=0; while(*des!=0) { bp=des; sp=sub;

2016-07-22 10:04:37 866

转载 memcpy用法

1、memcpy 函数用于 把资源内存(src所指向的内存区域) 拷贝到目标内存(dest所指向的内存区域);拷贝多少个?有一个size变量控制拷贝的字节数;函数原型:void *memcpy(void *dest, void *src, unsigned int count);用法:(1)可以拷贝任何类型的对象,因为函数的参数类型是void*(未定义类型指针),也就是说传进去的实参可

2016-07-21 11:04:19 427

原创 strcpy函数解析

#includeusing namespace std;#includechar * strcpyzr(char *des,const char*src){       assert(des!=NULL&&src!=NULL);char *p;p=des;while(*src!=0){*des=*src;src++;des++;}*des=0

2016-07-21 10:59:24 262

原创 字符串转换成数字

#includeusing namespace std;int str2int(char * str){int num=0;while(*str){num=num*10+(*str-'0');str++;}return num;}int main(){int n=0;char a[10];cin>>a;n=st

2016-07-21 10:38:52 360

转载 C语言堆栈入门——堆和栈的区别

原文:http://student.csdn.net/link.php?url=http://www.top-e.org/jiaoshi/html/427.html格式和部分内容稍作修改。在计算机领域,堆栈是一个不容忽视的概念,我们编写的C语言程序基本上都要用到。但对于很多的初学着来说,堆栈是一个很模糊的概念。堆栈:一种数据结构、一个在程序运行时用于存放的地方,这可能是很多初学者的

2016-07-20 17:25:33 151

原创 a++,++a

c=++a是表达式先处理自加运算后处理赋值运算;b=a++是表达式先处理赋值运算后处理自加运算;​第一种情况:a=3;b=a++;运行后b=3,a=4第二种情况:a=3;b=++a;运行后b=4,a=4

2016-07-20 17:24:27 154

原创 浅谈C++多态性

C++编程语言是一款应用广泛,支持多种程序设计的计算机编程语言。我们今天就会为大家详细介绍其中C++多态性的一些基本知识,以方便大家在学习过程中对此能够有一个充分的掌握。  多态性可以简单地概括为“一个接口,多种方法”,程序在运行时才决定调用的函数,它是面向对象编程领域的核心概念。多态(polymorphism),字面意思多种形状。  C++多态性是通过虚函数来实现的,虚函数允许子类重新定义成员函

2016-07-20 17:23:51 184

网络通信demo

网络通信的实用demo程序,有详细的注释,可以有效的入门网络通信的协议例子。

2016-07-21

三帧差值算法改进版

三帧差值算法改进版,有详细的注释,验证可以运行,效果挺好。对需要应用到帧间差值算法的可以直接拿来用。

2016-07-21

LearningOpenCV_Code

学习图像处理的入门代码,有注释,有讲解,对应的LearningOpenCV相关的代码。对图像处理技术由极大的帮助。

2016-07-21

空空如也

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

TA关注的人

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