自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

中国地质大学111132班学习小组

生命不止,奋斗不息

  • 博客(8)
  • 收藏
  • 关注

原创 【C++程序设计】补6.3 strcmp实现

#include using namespace std;#define MIN(a,b) (a<b?a:b)int strCmp(const char * str1, const char *str2){ int minLen=MIN(strlen(str1),strlen(str2)); for(int i=0;i<=minLen;i++){ if(str1[i]>str2[i]

2013-12-03 13:29:24 648

原创 【C++程序设计】补6.2 排序算法

排序方法有很多,例如冒泡排序、插入排序、归并排序、快速排序等等...... 我就介绍最简单的冒泡排序吧!1. 比较相邻的元素。如果第一个比第二个大,就交换他们两个。2. 对每一对相邻元素作同样的工作,从开始第一对到结尾的最后一对。在这一点,最后的元素应该会是最大的数。3. 针对所有的元素重复以上的步骤,除了最后一个。4. 持续每次对越来越少的元素重复上面的步骤,直到没有任何

2013-12-03 13:15:30 624

原创 【C++程序设计】补6.1 输出数组最大值及其下标

#define MAX(a,b) (a>b?a:b) int _tmain(int argc, _TCHAR* argv[]){ int arr[]={34,91,83,56,29,93,56,12,88,72}; int max=0, index=0, len=sizeof(arr)/sizeof(int); while(len--) { max=MAX(max,arr[len-1

2013-12-03 12:23:15 2169

原创 【C++程序设计】P123_4-9 Rectangle类

#include #include using namespace std;class Point{private: double x,y;public: Point(int xx,int yy){x=xx;y=yy;} double getX(){return x;} double getY(){return y;}};class Rectangle{private:

2013-11-15 16:25:09 848

原创 【C++程序设计】P123_4-8 Dog类

#include using namespace std;class Dog{private: char* name; int age; int weight;public: Dog(){name="";age=0;weight=0;} Dog(char* name, int age, int weight){ this->name=name; this->age=ag

2013-11-15 16:09:46 1158

原创 【C++程序设计】P123_4-10 设计一个用于人事管理的"人员“ 类

#include using namespace std;class Date{public: int year,month,day; Date(){} Date(int y,int m,int d){ year=y;month=m;day=d; }};enum SEX{MALE,FEMAL};class Person{private: int ID; SEX se

2013-11-15 15:58:41 6999 1

原创 【C++程序设计】P61_2-37 输出九九乘法表

题目:RT解答: for(int i=1;i<10;i++){ for(int j=1;j<=i;j++) cout<<i<<'*'<<j<<'='<<i*j<<'\t'; cout<<endl; }

2013-10-22 12:43:25 629

原创 【C++程序设计】P61_2-31 穷举法寻找质数

问题:用穷举法找出1~100的质数并显示出来。分别使用while、do-while、for循环语句实现。解答:1.while方法:int i=1,j;while( i++,j=1,i<=100){ while(j++,j<i) if(!(i%j)) break; if(i==j) cout<<i<<endl;}2.do-while方法:int i=2,j

2013-10-22 12:29:03 1784 2

空空如也

空空如也

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

TA关注的人

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