随笔
李明宇
这个作者很懒,什么都没留下…
展开
-
银行储蓄系统
/* *版权所有:Copyright (c)2015,烟台大学计算机与控制工程学院 *All rights reserved. * *文件名称:bank.h *文件标识:无 *内容摘要:该代码用于获取满足后缀要求的第一个文件 *其他说明:无 *当前版本:V1.0 *作 者:李明宇 *完成日期:2015年7月16日 * *修改记录: *修改日期:无 *版本号:V1.0 *修改人:李明宇 *修改原创 2015-07-18 14:38:32 · 594 阅读 · 0 评论 -
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 · 503 阅读 · 0 评论 -
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 · 526 阅读 · 0 评论 -
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 · 421 阅读 · 0 评论 -
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 · 527 阅读 · 0 评论 -
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 · 799 阅读 · 0 评论 -
引用作形参
#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 · 442 阅读 · 0 评论 -
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 · 478 阅读 · 0 评论 -
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 · 906 阅读 · 0 评论 -
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 · 517 阅读 · 0 评论 -
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 · 1080 阅读 · 0 评论 -
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 · 426 阅读 · 0 评论 -
第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 · 708 阅读 · 0 评论 -
第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 · 653 阅读 · 0 评论 -
十二周项目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 · 943 阅读 · 0 评论 -
十二周项目一
#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 · 628 阅读 · 0 评论 -
第八周项目一-实现复数类中的运算符重载
#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 · 594 阅读 · 0 评论 -
第六周项目一深复制
#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 · 440 阅读 · 0 评论 -
第五周项目程序阅读一
#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 · 305 阅读 · 0 评论 -
第五周项目一 体验常成员函数
#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 · 383 阅读 · 0 评论 -
第六周项目二我的数组类
#includeusing namespace std;class MyArray{private: int *arrayAddr; //保存一个有len个整型元素的数组的首地址 int len; //记录动态数组的长度 int max; //动态数组中的最大值(并非动态数组中必须要的数据成员)public: MyArray(int原创 2015-04-15 08:57:18 · 351 阅读 · 0 评论 -
第六周项目一深复制(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 · 486 阅读 · 0 评论 -
第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 · 535 阅读 · 0 评论 -
第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 · 433 阅读 · 0 评论 -
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 · 360 阅读 · 0 评论 -
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 · 419 阅读 · 0 评论 -
第十二周项目三——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 · 366 阅读 · 0 评论 -
第九周项目五——十个整数中最大值
/*文件名称:weq02.*作者:李明宇03.*完成日期:2014年10月23日04.*版本号:v1.005.*问题描述:十个整数最大值06.*输入描述:1 0个数07.*输出:最大值*/#include using namespace std;int main(){ int k,x,max; cin>>x; max=x; for(k=原创 2014-10-28 19:40:49 · 651 阅读 · 1 评论 -
第九周项目六——年龄
/*文件名称:weq02.*作者:李明宇03.*完成日期:2014年10月23日04.*版本号:v1.005.*问题描述:四个人的年龄成等差数列,他们年龄相加为26,相乘是880,求以他们的年龄为前四项的等差数列的前20项06.*输入描述:07.*输出:前二十项*/# includeusing namespace std;int main原创 2014-10-28 19:43:33 · 519 阅读 · 2 评论 -
第九周项目三——星号图
/*文件名称:weq02.*作者:李明宇03.*完成日期:2014年10月23日04.*版本号:v1.005.*问题描述:星号图06.*输入描述:无07.*输出:星号图*/#include using namespace std;int main(){ int i,j,k; for (i=1; i<=6; i++) { for (j原创 2014-10-28 19:33:59 · 341 阅读 · 0 评论 -
第九周项目四——乘法口诀表
/*文件名称:weq02.*作者:李明宇03.*完成日期:2014年10月23日04.*版本号:v1.005.*问题描述:乘法口诀表06.*输入描述:无07.*输出:乘法口诀表*/#include using namespace std;int main(){ cout << "我的小九九:" << endl; int i,j,s; fo原创 2014-10-28 19:37:38 · 352 阅读 · 0 评论 -
我的第一个程序
#include using namespace std;int main() { int r,r1,r2; cout cin>>ri>>r2; r=r1+r2; cout return 0;}原创 2014-10-09 15:20:15 · 571 阅读 · 3 评论 -
学习总结
上了大学,我初次接触c++原创 2014-10-07 20:37:44 · 516 阅读 · 1 评论 -
第十一周项目三——程序的多文件组织
/*文件名称: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 · 359 阅读 · 0 评论 -
第九周项目二——分数的累加
/*文件名称:weq 02.*作者:李明宇 03.*完成日期:2014年10月23日 04.*版本号:v1.0 05.*问题描述:计算1000以内所有偶数和 06.*输入描述:无 07.*输出:sum值#include using namespace std;int main(){ double x=1,y=3,z=1,su原创 2014-10-23 15:08:50 · 458 阅读 · 3 评论 -
第十一周项目二——最大公约数
/*文件名称: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 · 329 阅读 · 0 评论 -
第十二周项目三——最大公约数
/*文件名称: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 · 348 阅读 · 0 评论 -
第十二周项目二——盘子
/*文件名称: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 · 330 阅读 · 0 评论 -
个人所得税和税后收入
#include using namespace std;int main(){ double x,y,z; cout cin>>x; z=(x-3500); if (z>0&&z y=z*0.03; else if(z1500) y=z*0.10-105; else if原创 2014-10-19 15:56:41 · 872 阅读 · 2 评论 -
十一月总结
又是一个月的学习 。比起刚迈入大学的我,现在的我已经习惯了大学的生活,也开始了懒惰的生活,没有了刚进入大学时的雄心壮志。说好的好好学习到了现在也成了浮云,虽然现在上课依然听讲,下课依然该干什么干什么。但是开始的那股干劲已经不见了,发现了我自己的这个缺点,干什么都三分钟热度。唉,对于C++的学习虽然还好,但是刷积分的激情已经没有,有时还会在课上走神,只能课后用云学堂来恶补,学了许多知识,虽然也去实践原创 2014-11-30 11:02:27 · 529 阅读 · 2 评论