- 博客(27)
- 资源 (11)
- 收藏
- 关注
原创 18 周 oj 打倒魔王
/*从前有一个王子,他喜欢上了邻国的一个公主。终于有一天他向公主表白了,公主答应了他。在婚礼那天,可恶的魔王来了,他抢走了公主。王子很愤怒(╰_╯)#,他决定打上魔宫救回公主。临走那天,巫师给了他一本魔法书,让他可以看到自己与敌人的差距,来促使他不断进步。当王子可以打败怪物时魔法书显示:Trial!,当打不败时显示:You need more power!怪物的等级比较低,只有被攻
2014-06-24 18:33:06 545
原创 18周 oj 手机找回
/*小慧把手机掉了,着急的她想让你帮她找到,她的手机是很高级的,离开主人一定时间后就会发射固定频率的电磁波。现在你有一个仪器可以接受电磁波并能确定手机坐标,请你编程来确定小慧和手机的距离。4个double型的数,前两个是手机的坐标,后两个是小慧的坐标。*///以下代码会自动添加到程序的开始#include #include #include #include
2014-06-24 17:43:17 1734
原创 18周 oj 矩形类中运算符重载
/*定义一个矩形类,数据成员包括左下角和右上角坐标,定义的成员函数包括必要的构造函数、输入坐标的函数,实现矩形加法,以及计算并输出矩形面积的函数。要求使用提示中给出的测试函数并不得改动。 两个矩形相加的规则是:决定矩形的对应坐标分别相加,如 左下角(1,2),右上角(3,4)的矩形,与 左下角(2,3),右上角(4,5)的矩形相加,得到的矩形是 左下角(
2014-06-24 15:17:23 637
原创 17 oj 对象转换
#include #include#includeusing namespace std;class Student{public:Student(int,char[],char,float);int get_num(){ return num;}char *get_name(){ return name;}char ge
2014-06-17 14:57:49 484
原创 17周 oj 比较大小 类模板
/*声明一个类模板,利用它分别实现两个整数.浮点数和字符的比较,求出大数和小数。说明:在类模板外定义各成员函数。输入两个整数、两个浮点数和两个字符从大到小输出两个整数、两个浮点数和两个字符*/#include #include using namespace std;templateclass Compare{public: Compare
2014-06-17 14:05:37 866
原创 17 oj 输入输出 私有继承
#include using namespace std;class Student{public: void get_value() { cin>>num>>name>>sex; } void display( ) { cout<<"num: "<<num<<endl; cou
2014-06-17 12:52:46 650
原创 17周 oj 输入输出 公共继承
/*Student类含有私有数据成员:num,name,sex,公有成员函数: 输入函数get_value()和输出函数display()。采用公用继承方式实现类Student1, 增加数据成员:age,addr,成员函数:get_value_1()和display_1()。 在程序运行时输入num,name,sex,age,addr的值,调用输出函数输出以上5个数据的值。*/
2014-06-17 12:40:37 603
原创 16 oj 复数类 重载运算符3+
/*请编写程序,处理一个复数与一个double数相加的运算,结果存放在一个double型的变量d1中,输出d1的值,再以复数形式输出此值。定义Complex(复数)类,在成员函数中包含重载类型转换运算符: operator double() { return real; }*/#include #include using namespace std;class C
2014-06-12 20:19:11 616
原创 16 oj 矩阵求和 重载运算符
/* 有两个矩阵a和b,均为2行3列。求两个矩阵之和。重载运算符“+”,使之能用于矩阵相加(如c=a+b)。重载流插入运算符“>”,使之能用于该矩阵的输入和输出。 */#include using namespace std;class Matrix{public: Matrix(); friend Matrix operator+(Matrix &
2014-06-12 19:37:15 761
原创 16 oj 复数类 重载运算符+
/*定义一个复数类Complex,重载运算符“+”,使之能用于复数的加法运算。将运算符函数重载为非成员、非友元的普通函数。编写程序,求两个复数之和。*/#include #include using namespace std;class Complex{public: Complex(); Complex(double r,double i);
2014-06-12 18:37:41 624
原创 16 oj 输出日期时间 友元类
/*设计一个日期类和时间类,编写display函数用于显示日期和时间。要求:将Time类声明为Date类的友元类,通过Time类中的display函数引用Date类对象的私有数据,输出年、月、日和时、分、秒。*/#includeusing namespace std;class Date;class Time{public: Time(int h,in
2014-06-11 17:00:01 761
原创 16oj 输出日期时间 友元类
/*设计一个日期类和时间类,编写display函数用于显示日期和时间。要求:display函数作为类外的普通函数,分别在Time和Date类中将display声明为友元函数。在主函数中调用display函数,display函数分别引用Time和Date两个类的对象的私有数据,输出年、月、日和时、分、秒。*/#include using namespace std;cla
2014-06-10 17:48:38 934
原创 16 oj 结构体统计最高最低分
#includeusing namespace std;struct student{ string name; double score;};int main(){ student stu[5],s; for(int i=0; i<5; i++) { cin>>stu[i].name>>stu[i].sc
2014-06-10 16:42:42 723
原创 16 oj 对象数组求最大值
/*建立一个对象数组,内放n(n<10)个学生的数据(学号、成绩),用指针指向数组首元素,在max函数中找出n个学生中成绩最高者,并输出其学号。*/#include #include using namespace std;class Student{public: void input(); int get_num() {
2014-06-10 16:04:00 713
原创 16 oj 成绩输出
/*建立一个对象数组,内放n(n<10)个学生的数据(学号、成绩),用指针指向数组首元素,输出第奇数(1,3,5,7)个学生的数据。*/#include #include using namespace std;class Student{ public: void input(); void display(); private
2014-06-10 15:18:39 732
原创 16 oj 小平
/*小平帮老师处理期末成绩时遇到了问题。他需要计算每个同学的平均成绩,并判断他们是否通过了期末考试不及格成绩(<60),若都通过才能pass,若没通过要说明是哪几科未通过。因此他需要两个函数,一个求平均成绩(不考虑小数),另一个判断是否通过考试,通过输出pass,否则输出未通过的科目。请你们帮帮他!期末包括Chinese,Math,English三门课程。*/
2014-06-10 15:02:05 1094
原创 16 oj 最大数的输出
#include using namespace std;class Q{public: void set_value(); double get_Max();private: int n; int a[100];};void Q::set_value(){ cin>>n; for(int i=0; i<n
2014-06-10 14:07:27 766
原创 十五周 项目3 oop版电子词典
#include #include #include #include #include using namespace std;class Word{private: string english; string word_class; string chinese;public: friend istream& ope
2014-06-03 19:17:30 680
原创 15 oj 虚函数-计算图型面积 73-76行为何这样写,不懂
/*编写一个程序,定义抽象基类Shape,由它派生出5个派生类: Circle(圆形)、Square(正方形)、Rectangle(矩形)、Trapezoid(梯形)、Triangle(三角形)。用虚函数分别计算几种图形面积,并求它们之和。要求用基类指针数组,使它每一个元素指向一个派生类对象。 */#include #include using namespace st
2014-06-03 17:25:35 1059 1
原创 15 oj 抽象基类
/*编写一个程序,声明抽象基类Shape,由它派生出3个派生类:Circle(圆形)、Rectangle(矩形)、Triangle(三角形),用一个函数printArea分别输出以上三者的面积(结果保留两位小数),3个图形的数据在定义对象时给定*/#include #include using namespace std;class Shape{ publ
2014-06-03 16:58:30 594
原创 十五周 项目1.3 文本输入,输出工资
/*从文本中输入,输出数据*/#include #include using namespace std;int main( ){ double salarys[500]; int n=0; double t; freopen("salary.txt","r",stdin);//****** freopen("ordered_s
2014-06-03 15:01:10 533
原创 十五周 项目1.2 文本中输入工资
/*从文本中输入数据*/#include #include using namespace std;int main( ){ double salarys[500]; int n=0; double t; freopen("a.txt","r",stdin); while(cin>>salarys[n]) {
2014-06-03 14:52:47 553
原创 十五周 项目1 工资数据的输入
/* 输入员工工资1000-10000之间,并按从大到小输出*/#include using namespace std;int main( ){ double salarys[500]; int n=0; double t; while(cin>>salarys[n]) { n++; //从cin流读取数据
2014-06-03 14:40:45 807
原创 15oj 继承与组合
#include #include using namespace std;class BirthDate{public: BirthDate(int,int,int); void display(); void setbirthday(int,int,int);private: int year; int month;
2014-06-03 13:12:00 581
原创 15 oj 多重继承 提交时结果错误!!为什么
#include#include using namespace std;class Teacher{public: Teacher(string nam,int a,char s,string tit,string ad,string t); void display();protected: string name; int ag
2014-06-03 12:32:29 582
原创 oj 输入输出 保护继承
#include using namespace std;class Student{public: void get_value() { cin>>num>>name>>sex; } void display( ) { cout<<"num: "<<num<<endl; cou
2014-06-02 11:33:32 790 1
原创 oj C++继承(改错题)
#include using namespace std;class A{protected: int a,b;public: A(int aa, int bb):a(aa),b(bb) {} void printA() { cout<<"a: "<<a<<" b: "<<b<<endl; }};cla
2014-06-02 11:03:00 930
从实践中学习Oracle SQL(非常适合新手学习Oracle数据库的书籍,全是实例)
2016-12-30
基于javaweb实现的新闻发布管理系统
2016-12-29
图书管理系统(C#+SQL 适合毕业设计含毕业文档)
2016-12-29
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人