- 博客(6)
- 资源 (2)
- 收藏
- 关注
原创 目录及文件的递归输出
#include <stdio.h>#include <stdlib.h>#include<sys/types.h>#include<sys/stat.h>#include<dirent.h>#include<unistd.h>#include<string.h>int k=0;//当前层数voi
2018-10-22 19:49:47 162
原创 常量成员函数
在类的成员函数后可以加const,表示该函数不会修改成员变量的值(有时这个const是必须加的,不加编译器会报错)class Person{ int a; int b; public: void f(int& ,int&)const;};void Person::f(int &a1,int &b1)const{ ...
2018-10-14 23:01:11 178
原创 数组分割
/*问题描述:输入一行数,数的个数大于0且小于30,问:是否可将这组数分成两部分,这两部分的和相等*/bool f(int a[],int num1,int num2,int index,int i)//num1,num2想象为两个集合{ if(num1==num2 && index==i)return true; if(num1 != num2 &...
2018-10-13 22:38:35 427
原创 STL
1、bool comp(int&a,int& b){ return false;}int main(){ int a[5]={1,3,5,7,8}; sort(a,a+5,comp); for(int i=0;i<5;i++) { cout<<a[i]<<" "; } ...
2018-10-08 22:38:29 149
原创 类的前向声明
class person;void show1(person &k){ cout<<k.age<<endl;}class person{public: int age; int g;public: person(int a,int b) { age=a; g=b; }...
2018-10-02 20:52:30 621
原创 模板类中含有友元函数的书写规范
template <class T> class person; //模板类的声明template <class T>void show1(person<T>& ); //友元函数的声明template <class T>class person{public: T age; T g;public: ...
2018-10-02 20:36:28 301
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人