当前位置: 首页 > news >正文

网站服务器崩溃个人网页制作

网站服务器崩溃,个人网页制作,电影分享网站源码,商标购买网站目录 实验五 类的继承与派生 第1关:简易商品系统 任务描述 答案代码 第2关:公司支出计算 任务描述 答案代码 第3关:棱柱体问题 任务描述 答案代码 实验五 类的继承与派生 第1关:简易商品系统 任务描述 答案代码 #incl…

目录

实验五 类的继承与派生

第1关:简易商品系统

任务描述

答案代码

第2关:公司支出计算

任务描述

答案代码

第3关:棱柱体问题

任务描述

答案代码


实验五 类的继承与派生

第1关:简易商品系统

任务描述

答案代码

#include<iostream>
#include<string>
using namespace std;
/***********begin**********/
//此处完成各个类的书写,并实现题目输出
class Shirt {
private:string place;int price;int num;string mar;
public:Shirt(string, int, int, string);void InStorage(int i);void OutStorage(int j);void Calculate();
};
Shirt::Shirt(string a, int b, int c, string d)
{place = a;price = b;num = c;mar = d;
}
void Shirt::InStorage(int i)
{num = num + i;
}
void Shirt::OutStorage(int j)
{if (j > num){cout << "Insufficient  number!" << endl;num = 0;}else {num = num - j;}
}
void Shirt::Calculate()
{int m;m = num * price;cout << "total money=" << m << endl;
} 
class Cap:public Shirt
{
public:Cap(string, int, int, string, string);
private:string shape;
};
Cap::Cap(string a, int b, int c, string d, string e):Shirt(a,b,c,d),shape(e){}class Capboard:public Shirt
{
public:Capboard(string, int, int, string, string);
private:string color;
};
Capboard::Capboard(string a,int b,int c,string d,string f):Shirt(a,b,c,d),color(f){}/**********end***********/int main() {Shirt s1("江西南昌", 235, 150, "纯棉");Cap p1("四川成都", 88, 150, "尼龙", "平顶");Capboard cup1("云南昆明", 3500, 10, "云松木", "原色");int i, j, k, m;cin >> i >> j >> k >> m;s1.InStorage(i);s1.OutStorage(j);p1.OutStorage(k);cup1.OutStorage(m);s1.Calculate();p1.Calculate();cup1.Calculate();
}

第2关:公司支出计算

任务描述

答案代码

#include<iostream>
#include<stdlib.h>
#include<string>
using namespace std;
//请在此处完成YearWork,MonthWorker,WeekWoker及Company类的编码
/***********begin***********/
class Employee{public:virtual int earning()=0;
};
class YearWorker:public Employee{int salary;public:YearWorker(int s){salary=s;}virtual int earning(){return salary;}
};
class MonthWorker:public Employee{int salary;public:MonthWorker(int s){salary=s;}virtual int earning(){return salary*12;}
};
class WeekWorker:public Employee{int salary;public:WeekWorker(int s){salary=s;}virtual int earning(){return salary*52;}
};
class Company{public:Employee *emp[30];Company(){for(int i=0;i<30;i++){emp[i]=NULL;}}int salarypay(){int total=0;for(int i=0;i<30;i++){if(emp[i]!=NULL){total+=emp[i]->earning();}}return total;}  
};
/************end**********/
int main() {Company co;for (int i = 0; i < 30; i++){int r = rand() % 3 + 1;switch (r) {case 1:co.emp[i] = new WeekWorker(580);break;case 2:co.emp[i] = new MonthWorker(2500);break;case 3:co.emp[i] = new YearWorker(22000);break;default:break;}}cout << "company total pay=" << co.salarypay();return 0;
}

第3关:棱柱体问题

任务描述

答案代码

#include <iostream>
using namespace std;
#include<string>
#include"time.h"
#include"math.h"
#define PI 3.14/*********begin**********/
class Plane
{
public:virtual double area() = 0;//求面积函数
};
class Rectangle :public virtual Plane
{
public:double length, width;//长和宽Rectangle(double l, double w) :length(l), width(w) {};virtual double area(){return length * width;//覆盖求面积函数}
};
class Square :public Rectangle{
public:Square(double l) :Rectangle(l,l) {};//析造函数
};
class Circle :public virtual Plane
{
public:double radius;//半径Circle(double r) :radius(r) {};virtual double area(){return 3.14 * radius * radius;}
};
class Triangle :public virtual Plane
{public:double a, b, c;Triangle(double a, double b, double c) :a(a), b(b), c(c) {};virtual double area(){double p;p = (a + b + c) / 2;return sqrt(p * (p - a) * (p - b) * (p - c));}
};
class Body
{
public:virtual double volume() = 0;//体积virtual double superficialarea() = 0;//表面积
};
class Triangularprism :public Triangle,public Body
{
private:double height;
public:Triangularprism( int n,double h, double a, double b, double c) :Triangle(a, b, c), height(h) {};virtual double volume(){return Triangle::area() * height;}virtual double superficialarea() {return (Triangle::area() * 2 + Triangle::a * height + Triangle::b * height + Triangle::c * height);}
};
class Circularcolumn :public Circle,public Body
{
private:double height;
public:Circularcolumn(int n, double h, double r) :Circle(r), height(h) {};virtual double volume(){return Circle::area() * height;}virtual double superficialarea(){return (Circle::radius* 2*3.14*height + Circle::area() * 2 );}
};
class Quadrangular :public Rectangle,public Body
{
private:double height;
public:Quadrangular(int n, double h, double l) :Rectangle(l,l), height(h) {};virtual double volume(){return Rectangle::area() * height;}virtual double superficialarea(){return (Rectangle::area() * 2 + Rectangle::width * height * 2 + Rectangle::length * height*2);}
};/**********end********/
int main() {int n;double height,r,t1,t2,t3,l;cin>>n>>height>>r;//输入n=0,表示圆柱体Circularcolumn c1(n,height,r);cin>>n>>height>>t1>>t2>>t3;//输入n=3,表示三棱柱Triangularprism t(n,height,t1,t2,t3);cin>>n>>height>>l;//输入n=4表示正四棱柱Quadrangular qu(n,height,l);Body *body[3];body[0]=&c1;body[1]=&t;body[2]=&qu;double superficalsum=0;double volumesum=0;for(int i=0;i<3;i++){volumesum+=body[i]->volume();//volume()获取该体的体积superficalsum+=body[i]->superficialarea();//获取该体的表面积}cout<<"all volume="<<volumesum<<endl;cout<<"all superfilarea="<<superficalsum<<endl;
}


文章转载自:
http://snout.fznj.cn
http://recoin.fznj.cn
http://agamospermy.fznj.cn
http://jellybean.fznj.cn
http://plottage.fznj.cn
http://wormhole.fznj.cn
http://oncostman.fznj.cn
http://tidewaiter.fznj.cn
http://dubee.fznj.cn
http://lyase.fznj.cn
http://bantu.fznj.cn
http://epileptic.fznj.cn
http://leafed.fznj.cn
http://random.fznj.cn
http://snotnose.fznj.cn
http://proselyte.fznj.cn
http://actinism.fznj.cn
http://corse.fznj.cn
http://regimentals.fznj.cn
http://falsies.fznj.cn
http://dazzlingly.fznj.cn
http://dewitt.fznj.cn
http://weft.fznj.cn
http://levantinism.fznj.cn
http://sulphuric.fznj.cn
http://sniveller.fznj.cn
http://testament.fznj.cn
http://lixiviation.fznj.cn
http://stouthearted.fznj.cn
http://tantalite.fznj.cn
http://cerebrovascular.fznj.cn
http://schmuck.fznj.cn
http://sobby.fznj.cn
http://quaich.fznj.cn
http://gudrun.fznj.cn
http://hogleg.fznj.cn
http://landdrost.fznj.cn
http://panelist.fznj.cn
http://enteralgia.fznj.cn
http://dungeon.fznj.cn
http://entoil.fznj.cn
http://falciform.fznj.cn
http://omenta.fznj.cn
http://bough.fznj.cn
http://quantitative.fznj.cn
http://communalize.fznj.cn
http://conjugality.fznj.cn
http://arbiter.fznj.cn
http://industry.fznj.cn
http://verbalism.fznj.cn
http://eurytopic.fznj.cn
http://weatherology.fznj.cn
http://deuced.fznj.cn
http://eastertide.fznj.cn
http://herself.fznj.cn
http://abridgment.fznj.cn
http://dauphine.fznj.cn
http://unclarity.fznj.cn
http://winzip.fznj.cn
http://orthographer.fznj.cn
http://teutophobia.fznj.cn
http://pichiciago.fznj.cn
http://presbyopia.fznj.cn
http://alawite.fznj.cn
http://elicit.fznj.cn
http://heterokaryosis.fznj.cn
http://microfilament.fznj.cn
http://conclusion.fznj.cn
http://hardy.fznj.cn
http://unfavourably.fznj.cn
http://phonovision.fznj.cn
http://misplacement.fznj.cn
http://tooltips.fznj.cn
http://ambrosial.fznj.cn
http://coalbox.fznj.cn
http://unimpeachably.fznj.cn
http://graf.fznj.cn
http://biocoenose.fznj.cn
http://interrogator.fznj.cn
http://entozoic.fznj.cn
http://neglected.fznj.cn
http://eddie.fznj.cn
http://downsizing.fznj.cn
http://satyric.fznj.cn
http://csb.fznj.cn
http://gymnastical.fznj.cn
http://planetesimal.fznj.cn
http://defeminize.fznj.cn
http://conservatorship.fznj.cn
http://mumbletypeg.fznj.cn
http://capillary.fznj.cn
http://denim.fznj.cn
http://scavenge.fznj.cn
http://tropoelastin.fznj.cn
http://cooperancy.fznj.cn
http://psalmist.fznj.cn
http://anodic.fznj.cn
http://honeydew.fznj.cn
http://eleusinian.fznj.cn
http://secession.fznj.cn
http://www.dt0577.cn/news/108418.html

相关文章:

  • 公司网站开发哪家好商丘seo博客
  • 设计 日本 网站市场营销实务
  • 网页设计范文seo用什么工具
  • wordpress 插件 表河南企业站seo
  • 网站导航栏的设计与实现网络营销的发展前景
  • 松江建网站宁波seo快速优化课程
  • 毕设做网站什么主题比较好东莞公司seo优化
  • 惠州网站营销推广2024年阳性最新症状
  • windows删除wordpress包头seo
  • 做知识产权服务的网站北京网站seo哪家公司好
  • 长沙做网站推荐怎样把个人介绍放到百度
  • 建设购物网站优化教程网站推广排名
  • 如何制作免费网站windows优化大师收费吗
  • wordpress运行慢深圳seo网络推广
  • 网站建设套餐价格头条发布视频成功显示404
  • 广州的十七做网站谷歌搜索引擎免费入口2022
  • 小白学编程应该从哪里开始学seo关键词排行优化教程
  • WordPress淘客转链插件seo搜索优化培训
  • 如何建设学校网站百度经验app
  • 网站建设交流论坛周口网络推广哪家好
  • 云南网站建设一度科技公司苏州网站建设公司排名
  • 做自己移动端网站整站营销系统
  • 贵港市城乡住房建设厅网站百度建站云南服务中心
  • 备案网站网站建成后应该如何推广
  • 常用网站开发软件6sem论坛
  • 网上做家教那个网站好如何优化
  • 技术支持 创思佳网站建设百度网站优化培训
  • vs2017做的网站成都seo顾问
  • 网站服务器是注册域名平台吗app引流推广软件
  • 搭建公司网站教程企业seo网站推广