自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 求图形周长(三角形和矩形)并且求它们周长之和

//用shape类定义求周长函数#include<iostream>using namespace std;class shape//抽象类{public: virtual float length() = 0;//求图形周长的函数};float total(shape *s[],int n)//求不同形状图形周长总和的函数{ float sum = 0.0; f...

2018-02-05 16:17:21 972

原创 递归法判断递增数组

#include<iostream>using namespace std;bool fn(int *a,int n){ if(n == 1) return true; else if(a[n-1] > a[n-2]) fn(a,n-1);//递归调用fn函数,直到n = 1,比较完成,返回true else return false;}void ma...

2018-02-05 11:58:05 455

原创 二进数中1的个数

//判断二进制数中1的个数(输入的x为十进制数)#include<iostream>using namespace std;int fun(int x){ int n = 0; while(x) { n++;//计数,每循环一次加一 x = x&(x-1);//每次减少一个1,计数器加一,直到数为0 } return n;}void main()...

2018-02-05 10:51:44 175

原创 Template Stack

#include<iostream>#include<assert.h>using namespace std;template <class T1,int Size = 10>class Stack{public: Stack() { top = -1; }//初始化栈 void push(const T1 &item) {...

2018-02-03 13:31:26 258

原创 String

#include<iostream>#include<string>using namespace std;class String{public: String(const char *str = NULL)//普通构造函数 { if(str == NULL) { m_data = new char[1]; m_data = '\0';...

2018-02-03 10:40:52 214

空空如也

空空如也

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

TA关注的人

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