- 博客(51)
- 收藏
- 关注
原创 银行储蓄系统
/* *版权所有:Copyright (c)2015,烟台大学计算机与控制工程学院 *All rights reserved. * *文件名称:bank.h *文件标识:无 *内容摘要:该代码用于获取满足后缀要求的第一个文件 *其他说明:无 *当前版本:V1.0 *作 者:李明宇 *完成日期:2015年7月16日 * *修改记录: *修改日期:无 *版本号:V1.0 *修改人:李明宇 *修改
2015-07-18 14:38:32 626
原创 十二周项目2
#include #include#include using namespace std;enum vehicleStaus {rest, running}; //车辆状态:泊车、行进class vehicle //车辆类{protected: int maxSpeed; //最大车速 int currentSpeed; //当前速度 int weigh
2015-05-27 09:19:37 1053
原创 十二周项目一
#include #includeusing namespace std;class Teacher{public: Teacher(string na,int a,char s,string ti,string ad,string t):name(na),age(a),sex(s),title(ti),addr(ad),tel(t){ } void display();
2015-05-27 08:43:31 638
原创 第八周项目一-实现复数类中的运算符重载
#include using namespace std;class Complex{public: Complex(){real=0;imag=0;} Complex(double r,double i){real=r; imag=i;} Complex operator+(const Complex &c2); Complex operator-(con
2015-04-29 08:20:08 604
原创 第六周项目二我的数组类
#includeusing namespace std;class MyArray{private: int *arrayAddr; //保存一个有len个整型元素的数组的首地址 int len; //记录动态数组的长度 int max; //动态数组中的最大值(并非动态数组中必须要的数据成员)public: MyArray(int
2015-04-15 08:57:18 377
原创 第六周项目一深复制(3)
#include#includeusing namespace std;class A{private: char *a;public: A(char *aa) { a = new char[strlen(aa)+1]; //(a)这样处理的意义在于:_ 保存字符串中的'/n' strcpy(a, aa); //(b)数据成员
2015-04-15 08:33:53 498
原创 第六周项目一深复制
#include#includeusing namespace std;class A{private: char *a;public: A(char *aa) { a = new char[strlen(aa)+1]; //(a)这样处理的意义在于:_ 保存字符串中的'/n' strcpy(a, aa);
2015-04-15 08:19:03 462
原创 第五周项目一 体验常成员函数
#include #include using namespace std;class CPoint{private: double x; // 横坐标 double y; // 纵坐标public: CPoint(double xx=0,double yy=0); double Distance1(CPoint p) const;
2015-04-08 09:13:11 408
原创 第五周项目程序阅读一
#include using namespace std;class base{private : int m ;public : base () {}; base(int m){this->m=m;} int get () {return m;} void set (int m){this->m=m;}};//
2015-04-08 08:52:38 331
原创 第3周项目5数组作数据成员
#include using namespace std; class Salary { private: double salarys[50]; int number; public: void set_salarys(); void add_salarys(int x); void sort_salarys
2015-03-29 20:31:46 562
原创 第3周项目4考了语文数学的学生
#include #include using namespace std; class Stu { private: string name; //学生姓名 float chinese; //语文成绩 float math; //数学成绩 //接下去写 public: void setStuden
2015-03-29 20:30:44 459
原创 第3周项目2三角形类2
#include #include using namespace std; class Triangle { public: void setA(double x) { a=x; }; void setB(double y) { b=y; }; vo
2015-03-29 20:28:45 681
原创 第3周项目1三角形类1
#include #include #include using namespace std; class Triangle { public: void setABC(double x, double y, double z);//置三边的值,注意要能成三角形 void getABC(double *x, double *y, double *z)
2015-03-29 20:26:48 737
原创 试验
class Time{public: Time( ); Time(int h,int m=0,int s=0); void show_time( );private: int hour; int minute; int sec;};Time::Time( ) : hour(0), minute(0), sec(0){ }Time:
2015-03-29 20:07:40 805
原创 17-1体会函数参数
#include using namespace std; void fun1(int &x,int &y); void fun2(int *x, int *y); int main() { int a,b; a=11; b=22; fun2(&a,&b); cout<<"a="<<a<<" b="<<b<<endl
2014-12-23 21:10:11 807
原创 引用作形参
#include using namespace std; void f1(int *x,int *y,int *z); void f2(int &x,int &y,int &z); int main() { int a,b,c; cin>>a>>b>>c; f1(&a,&b,&c); cout<<"降序排列为:"<<a<
2014-12-23 21:08:21 450
原创 17-3胖子伤不起
#include using namespace std; struct people { char name[20]; char sex; double height; double weight; }; int main() { double z,b; people p; cin
2014-12-23 21:06:07 488
原创 17-4生日差几天
#include using namespace std; struct Date { int year; int month; int day; }; int main() { Date date,time; cout<<"第一人的生日为:"; cin>>date.year>>date.month>
2014-12-23 21:04:11 921
原创 16-4动态数组扩容
#include using namespace std; int main( ) { int num,i,addNum; //num是小组人数 cout<<"输入学生人数: "; cin>>num; int *score = new int[num]; cout<<"请输入学生成绩: "<<endl;
2014-12-16 21:20:13 1091
原创 16-3函数指针调用
#include using namespace std; void eat(); void sleep(); void hitdoudou(); void run(void (*f)()); int main() { int iChoice; do { cout<<"请选择(1-吃;2-睡;3-打;其他
2014-12-16 21:16:00 524
原创 16-2 连接字符串
#include using namespace std; char *pstrcat(char *str1,char *str2); int main(){ char s1[50]="Hello world. "; char s2[50]="Good morning. "; pstrcat(s1,s2); cout<<"连接后:"<<
2014-12-15 19:55:17 427
原创 16-1 排序
#include using namespace std; void sort(int *p,int num); void output(int *p,int num); int main( ) { int a[20]= {86,46,22,18,77,45,32,80,26,88,57,67,20,18,28,17,54,49,11,16}; int
2014-12-15 19:53:23 370
原创 16-黑豆
#include using namespace std; int main() { int i,n,a=0,c=0; int max1=0,max2=0,max3=0; cout<<"输入黑豆数量:"; cin>>n; for(i=0;i<n;i++) { if(i%3==2&&
2014-12-15 19:50:29 444
原创 oj4
#include using namespace std; int main( ) { int *p1,*p2,t; //本程序以下不准再加入新的变量,下面用new操作符分配空间,并用p1、p2分别保存其地址 p1=new int; p2=new int; //下面输入两个整数。若无上面分配的空间,这样操作指赂的空间,
2014-12-09 22:09:17 429
原创 oj3
#include using namespace std; int main( ) { int *p1,*p2,a,b,t; cin>>a>>b; p1=&a; p2=&b; if(*p1<*p2) { t=*p1; *p1=*p2; *p2=t; }
2014-12-09 22:07:59 540
原创 oj2
#include using namespace std; void jiaohuan(int *p1, int *p2); int main( ) { int a,b; cin>>a>>b; jiaohuan(&a,&b); cout" " return 0; } void jiaohuan(int *
2014-12-09 22:06:38 546
原创 oj
#include using namespace std; void ast(int x,int y,int *cp,int *dp) { *cp=x+y; *dp=x-y; } int main() { int a,b,c,d; cin>>a>>b; //下面调用函数ast ast(a,b,&c,&
2014-12-09 22:04:30 537
原创 十一月总结
又是一个月的学习 。比起刚迈入大学的我,现在的我已经习惯了大学的生活,也开始了懒惰的生活,没有了刚进入大学时的雄心壮志。说好的好好学习到了现在也成了浮云,虽然现在上课依然听讲,下课依然该干什么干什么。但是开始的那股干劲已经不见了,发现了我自己的这个缺点,干什么都三分钟热度。唉,对于C++的学习虽然还好,但是刷积分的激情已经没有,有时还会在课上走神,只能课后用云学堂来恶补,学了许多知识,虽然也去实践
2014-11-30 11:02:27 560 2
原创 第十四周项目1——折腾二维数组
#include using namespace std;int main( ){ int i,j; //创建数组,为数组中的前两列的10个元素赋初值 int a[5][4]= {{0,1},{4,5},{8,9},{12,13},{16,17}}; //键盘输入后两列10个元素的值 cout<<"请输入10个整数:"<<endl;
2014-11-27 15:16:55 372
原创 第十二周项目三——n的阶乘
/*文件名称:weq*作者:李明宇*完成日期:2014年11月16日*版本号:v1.0*问题描述:n的阶乘*输入描述:无*输出:*/#include using namespace std;long fac(int);int main(){ int n,y; cin>>n; y=fac(n); cout<<n<<"!="<<y<<endl
2014-11-18 21:37:03 378
原创 第十二周项目三——最大公约数
/*文件名称:weq*作者:李明宇*完成日期:2014年11月16日*版本号:v1.0*问题描述:最大公约数*输入描述:无*输出:*/#include using namespace std;int gcd(int,int);int main(){ int a,b,n,d; cin>>a>>b; d=gcd(a,b); cout<<d<<
2014-11-18 21:33:19 357
原创 第十二周项目二——盘子
/*文件名称:weq *作者:李明宇 *完成日期:2014年11月16日 *版本号:v1.0 *问题描述:盘子 *输入描述:无 *输出: */#include using namespace std;void move(int , char , char ,char);int main(){ int n; cin>>n; mov
2014-11-18 21:28:45 342
原创 第十一周项目三——程序的多文件组织
/*文件名称:weq *作者:李明宇 *完成日期:2014年11月6日 *版本号:v1.0 *问题描述:大小 *输入描述:无 *输出:大小 */#include using namespace std;int max (int x, int y);int min (int x,int y);extern int x,y;int main(
2014-11-10 10:59:06 367
原创 第十一周项目二——最大公约数
/*文件名称:weq *作者:李明宇 *完成日期:2014年11月6日 *版本号:v1.0 *问题描述:最大公约数 *输入描述:无 *输出:最大公约数 */#include using namespace std;int gcd(int a,int b)int r,g;while (b!=0){ r=a%b; a=b;
2014-11-10 10:32:54 336
原创 第十一周项目一——变种2
/*文件名称:weq*作者:李明宇*完成日期:2014年11月6日*版本号:v1.0*问题描述:变种2*输入描述:无*输出:变种2*/ #include using namespace std;void printchs(int m,char a){ for (int j=1; j<=m; ++j) cout<<a;}
2014-11-06 15:19:46 389
原创 第十一周项目一-----变种
#include using namespace std;void printchs(int m,char a){ for (int j=1; j<=m; ++j) cout<<a;}int main(){ int n=6; int i; for (i=1; i<=n; ++i) {
2014-11-06 15:14:27 534 1
原创 第十一周项目一——星号图
/*文件名称:weq 02.*作者:李明宇 03.*完成日期:2014年11月6日 04.*版本号:v1.0 05.*问题描述:星号图 06.*输入描述:无 07.*输出:星号图#include using namespace std;void printstars(int m) //定义能输出一行m个星号的函数{ for (int j=1; j<=m; ++j)
2014-11-06 15:03:41 417
原创 第十周项目五——完数
#include using namespace std;int main(){ int i,k,sum; for(i=2; i<=1000; i++) { sum=1; for(k=2;k<=i/2;k++) if(i%k==0) sum+=k; if(
2014-11-04 20:32:34 348
原创 第十周项目四——评分
/*文件名称:weq 02.*作者:李明宇 03.*完成日期:2014年10月31日 04.*版本号:v1.0 05.*问题描述:星号图 06.*输入描述:无 07.*输出:星号图 #include using namespace std;int main(){ double s,t,sum=0,max=0,min=10; int i=1,p; cout<<"请输入评
2014-11-04 20:26:53 310
原创 第十周项目三——血型统计
/*文件名称:weq 02.*作者:李明宇 03.*完成日期:2014年10月31日 04.*版本号:v1.0 05.*问题描述:血型 06.*输入描述:无 07.*输出:星号图 #include #include using namespace std;int main(){ int a=0,b=0,o=0,c=0; char blood; cout<<"请输
2014-11-04 20:21:09 387
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人