- 博客(51)
- 收藏
- 关注
原创 c++总结
c++总结 本学期学到了不少东西,不仅仅获得了知识,也学会了见到了困难以怎样的心态去面对和解决困难的方案。 c++和c语言最大的不同就是面向对象,增加了类和对象,派生和继承,泛型程序设计。将成员和成员函数封装成类,将输入输出抽象为流,可以对运算符进行重载,编程相对于c语言更加高效。但是也不能否认,c语言是最适合入门的语言,通过c语言可以学到c++的很多原理,对于学习c++来说,有着很大的帮助
2016-06-24 17:46:14
599
原创 人数不定的工资类
/* *Copyright (c) 2016,烟台大学计算机学院 *All rights reserved. *文件名称:zwj.cpp *作 者:徐伟 *完成日期:2016年6月15日 *版 本 号:v1.0 * *问题描述: 设计一个工资类(Salary), 其中的数据成员包括职工人数(number,人数不定)和number个职工的工资salary, 要求输入职工工资并逐个输出。
2016-06-15 18:38:27
415
原创 存储班长信息的学生类
/* *copyright (t) 2016,烟台大学计算机学院 *All rights reserved. *文件名称:test.cpp *作者:徐伟 *完成日期:2016年6月15日 *版本号:v1.0 *问题描述:将Stu类的数据成员的访问权限改为private,修改程序。 *输入描述:无 *程序输出:如图片所示 */ #include #include using na
2016-06-15 18:35:37
368
原创 警察和厨师2
/* *copyright (t) 2016,烟台大学计算机学院 *All rights reserved. *文件名称:test.cpp *作者:徐伟 *完成日期:2016年6月15日 *版本号:v1.0 *问题描述: 【项目-警察和厨师】 (1)根据下面的类图,定义各个类: 要求: 各个成员函数,只要输出相关的信息即可,暂不深究其业务功能 请为各个类增加构造函数 在实
2016-06-15 17:45:41
459
原创 警察与厨师
/* *copyright (t) 2016,烟台大学计算机学院 *All rights reserved. *文件名称:test.cpp *作者:徐伟 *完成日期:2016年6月15日 *版本号:v1.0 *问题描述: 【项目-警察和厨师】 (1)根据下面的类图,定义各个类: 要求: 各个成员函数,只要输出相关
2016-06-15 17:00:30
526
原创 第十二周阅读程序2
// // main.cpp // project // // Created by 徐伟 on 6/15/16. // Copyright © 2016 fizz_i. All rights reserved. // #include using namespace std; class Sample { private: int x; public: Sample
2016-06-15 16:33:40
392
原创 摩托车继承自行车和机动车
// // main.cpp // project // // Created by 徐伟 on 6/15/16. // Copyright © 2016 fizz_i. All rights reserved. // #include #include #include using namespace std; enum vehicleStaus {rest, running}
2016-06-15 16:26:32
447
原创 第十二周阅读程序1
// // main.cpp // project // // Created by 徐伟 on 6/15/16. // Copyright © 2016 fizz_i. All rights reserved. // #include using namespace std; class Sample { private: int x; public: Sample
2016-06-15 16:20:00
410
原创 数组类运算的实现
// // main.cpp // project // // Created by 徐伟 on 6/15/16. // Copyright © 2016 fizz_i. All rights reserved. // #include #include #include using namespace std; class Array { private: int* lis
2016-06-15 16:07:16
469
原创 string的构造
// // main.cpp // project // // Created by 徐伟 on 6/15/16. // Copyright © 2016 fizz_i. All rights reserved. // #include #include using namespace std; class String { public: String ();//默认构
2016-06-15 16:02:13
592
原创 洗牌(程序阅读)
#include #include #include #include #include #include using namespace std; using namespace std; typedef vector IntVector; typedef unsigned int VIndex; void vectorShuffle(IntVector &unshuffled,I
2016-06-14 23:44:32
478
原创 程序填空(泛型程序设计)
// // main.cpp // project // // Created by 徐伟 on 6/14/16. // Copyright © 2016 fizz_i. All rights reserved. // #include #include #include #include using namespace std; void Show(double); int
2016-06-14 23:39:20
590
原创 阅读程序
//例:使用成员函数、友元函数和一般函数的区别 #include using namespace std; class Time { public: Time(int h,int m,int s):hour(h),minute(m),sec(s) {} void display1(); //display1是成员函数 friend void display2(Tim
2016-06-14 20:46:12
442
原创 成员函数友元函数和一般函数有区别
// // main.cpp // project // // Created by 徐伟 on 6/14/16. // Copyright © 2016 fizz_i. All rights reserved. // #include #include using namespace std; class CPoint { private: double x; // 横坐标
2016-06-14 20:42:57
435
原创 静态成员应用
// // main.cpp // project // // Created by 徐伟 on 6/14/16. // Copyright © 2016 fizz_i. All rights reserved. // #include using namespace std; class Time { public: Time(int=0,int=0,int=0);
2016-06-14 19:59:55
377
原创 IP地址类
// // main.cpp // project // // Created by 徐伟 on 6/14/16. // Copyright © 2016 fizz_i. All rights reserved. // #include using namespace std; class IP { private: union { struct
2016-06-14 17:24:50
403
原创 Time类的运算符重载
// // main.cpp // project // // Created by 徐伟 on 6/8/16. // Copyright © 2016 fizz_i. All rights reserved. // #include using namespace std; class CTime { private: unsigned short int hour;
2016-06-14 17:00:09
477
原创 时间类
// // main.cpp // activity // // Created by 徐伟 on 6/13/16. // Copyright © 2016 fizz. All rights reserved. // #include using namespace std; class Time { public: void set_time( ); void sho
2016-06-14 16:29:13
412
原创 游戏角色类
// // main.cpp // activity // // Created by 徐伟 on 6/13/16. // Copyright © 2016 fizz. All rights reserved. // #include using namespace std; class Role { public: void eat(int d); //吃东西,涨d血
2016-06-13 20:53:16
569
原创 三角形类
// // main.cpp // activity // // Created by 徐伟 on 6/13/16. // Copyright © 2016 fizz. All rights reserved. // #include #include #include using namespace std; class Triangle { public: void setA
2016-06-13 20:51:36
762
原创 汉诺塔问题
// // main.cpp // activity // // Created by 徐伟 on 6/13/16. // Copyright © 2016 fizz. All rights reserved. // #include using namespace std; const int discCount=3; void move(int, char, char,char);
2016-06-13 20:33:45
249
原创 用递归的方法求解3
// // main.cpp // activity // // Created by 徐伟 on 6/13/16. // Copyright © 2016 fizz. All rights reserved. // //递归法 #include using namespace std; int fib(int n); int main() { cout<<fib(20)<<e
2016-06-13 20:16:01
371
原创 用递归方法求阶乘2
// // main.cpp // activity // // Created by 徐伟 on 6/13/16. // Copyright © 2016 fizz. All rights reserved. // #include using namespace std; long f(int); int main( ) { int n; long y; c
2016-06-13 20:14:46
310
原创 递归求阶乘
// // main.cpp // activity // // Created by 徐伟 on 6/13/16. // Copyright © 2016 fizz. All rights reserved. // #include using namespace std; long fact(int); //函数声明 int ma
2016-06-13 20:12:48
287
原创 小学生算数能力系统
// // main.cpp // activity // // Created by 徐伟 on 6/13/16. // Copyright © 2016 fizz. All rights reserved. // #include #include #include int qa(); //函数声明,完成一道题的测试并返回评判结果,正确1为,错误为0 using namespac
2016-06-13 20:11:22
390
原创 猜数字游戏
// // main.cpp // activity // // Created by 徐伟 on 6/13/16. // Copyright © 2016 fizz. All rights reserved. // #include #include #include using namespace std; int main(int argc,const char *argv[]
2016-06-13 20:09:17
218
原创 求最大公约数
// // main.cpp // activity // // Created by 徐伟 on 6/13/16. // Copyright © 2016 fizz. All rights reserved. // #include using namespace std; int fun(int a,int b); int main() { int a,b; co
2016-06-13 20:04:35
271
原创 穷举法解决组合问题
// // main.cpp // activity // // Created by 徐伟 on 6/13/16. // Copyright © 2016 fizz. All rights reserved. // #include using namespace std; int main() { int i,j,k,count=0; for(i=0;i<=100;
2016-06-13 19:57:47
391
原创 输出型号图2
#include using namespace std; int main( ) { int i,j,n=6; for(i=n;i>=1;--i) //一共要输出n行 { //输出第i行 for(j=1; j<=2*i-1; ++j) //输出2*i-1个星号 cout<<"*"; cout<<endl; } return 0; }
2016-06-09 09:13:10
328
原创 输出星号图
#include using namespace std; int main( ) { int i,j; i=1; while(i<=6) //需要输出6行 { //输出第i行 for(j=1; j<=i-1; ++j) cout<<" "; for(j=1; j<=2*(6-i)+1; ++j) cout<<"*"; cout<<
2016-06-09 09:04:04
442
原创 本月天数
// // main.cpp // project // // Created by 徐伟 on 6/8/16. // Copyright © 2016 fizz_i. All rights reserved. // #include using namespace std; int main() { int year, month, days; cout << "请
2016-06-08 20:43:39
495
原创 个人所得税计算器
// // main.cpp // project // // Created by 徐伟 on 6/8/16. // Copyright © 2016 fizz_i. All rights reserved. // #include using namespace std; int main( ) { double dSalary,dTax=0,dNetIncome=0;
2016-06-08 20:38:14
511
原创 数组类模板
// // main.cpp // project // // Created by 徐伟 on 6/8/16. // Copyright © 2016 fizz_i. All rights reserved. // #include using namespace std; template class Array { private: T*list; int
2016-06-08 20:31:17
403
原创 两个成员的类模板
// // main.cpp // project // // Created by 徐伟 on 6/5/16. // Copyright © 2016 fizz_i. All rights reserved. // #include using namespace std; template class Test{ public: Test(T1 date1,T2 d
2016-06-06 17:02:39
246
原创 排序函数模板
// // main.cpp // project // // Created by 徐伟 on 6/5/16. // Copyright © 2016 fizz_i. All rights reserved. // #include using namespace std; template void abs(T a[],int size) { int i,j;
2016-06-06 12:42:36
440
原创 立体类族共有的抽象类
// // main.cpp // project // // Created by 徐伟 on 6/5/16. // Copyright © 2016 fizz_i. All rights reserved. // /* 设计一个抽象类CSolid,含有用于求表面积及体积的两个纯虚函数。设计派生类CCube、CBall、CCylinder,分别表示正方体、球体及圆柱体。在main()函
2016-06-05 17:49:13
281
原创 形状类族中的纯虚函数
// // main.cpp // project // // Created by 徐伟 on 5/31/16. // Copyright © 2016 fizz_i. All rights reserved. // #include using namespace std; class Shape { public: Shape(double L,double W):L
2016-06-05 15:20:34
327
原创 银行管理系统
#include #include #include #include using namespace std; class Accout { protected: string name; double money; string ID; string Phone; public: Accout(string na
2016-06-02 09:24:52
996
原创 动物可以这样叫(纯虚函数)
// // main.cpp // project // // Created by 徐伟 on 5/31/16. // Copyright © 2016 fizz_i. All rights reserved. // #include #include using namespace std; class Animal { public: virtual void cry(
2016-05-31 19:37:30
398
原创 运算符重载一
// // main.cpp // c++ // // Created by 徐伟 on 16/4/19. // Copyright © 2016年 fizz. All rights reserved. // #include #include using namespace std; class CFraction { private: int nume; // 分子
2016-05-25 22:21:20
251
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人