设计Person类 代码参考
- #include <iostream>
- using namespace std;
- class Trapezium
- {
- private:
- int x1,y1,x2,y2,x3,y3,x4,y4;
- public:
- void initial(){x1=,x2=;x3=;x4=;y1=;y2=;y3=;y4=;return;}
- void GetPosition(int&,int&,int&,int&,int&,int&,int&,int&);
- void Area()
- {
- double s;
- s=((x2-x1)+(x4-x3))*(y2-y4)/2.0;
- cout<<s<<endl;
- return;
- }
- };
- void Trapezium::GetPosition(int& a,int& b,int& c,int& d,int& e,int& f,int& g,int& h)
- {
- x1=a;y1=b;x2=c;y2=d;x3=e;y3=f;x4=g;y4=h;
- return;
- }
- int main()
- {
- int x[],y[];
- Trapezium one;
- for(int i=;i<;i++) cin>>x[i]>>y[i];
- one.initial();
- one.GetPosition(x[],y[],x[],y[],x[],y[],x[],y[]);
- one.Area();
- return ;
- }
设计Person类 代码参考的更多相关文章
- 设计Dog类 代码参考
#include <iostream> #include <string> using namespace std; class Dog { private: string n ...
- 设计MyTime类 代码参考
#include <iostream> #include <cstdio> using namespace std; class MyTime { private: int h ...
- 设计Weekday类 代码参考
#include <iostream> using namespace std; class Weekday { private: int num; public: void SetDay ...
- 设计一个多功能的MyTime类 代码参考
#include <iostream> #include <cstdio> using namespace std; class MyTime { private: int h ...
- 设计带构造函数的Dog类 代码参考
#include <iostream> #include <string> using namespace std; class Dog { private: string n ...
- 设计并测试Trapezium类 代码参考
#include <iostream> using namespace std; class Trapezium { private: int x1,y1,x2,y2,x3,y3,x4,y ...
- 从Student类和Teacher类多重派生Graduate类 代码参考
#include <iostream> #include <cstring> using namespace std; class Person { private: char ...
- 从Point类继承的Circle类 代码参考
#include <iostream> #include <cstring> using namespace std; class Point { private: int x ...
- 一个基类Person的多个派生类 代码参考
#include <iostream> #include <cstring> using namespace std; class Person { protected: ch ...
随机推荐
- ELK+kafka日志收集分析系统
环境: 服务器IP 软件 版本 192.168.0.156 zookeeper+kafka zk:3.4.14 kafka:2.11-2.2.0 192.168.0.42 zookeeper+kaf ...
- TCP 可靠传输
TCP报文段首部 序号: TCP是面向字节流的.在一个TCP连接中传送的字节流中的每一个字节都按顺序编号.整个要传送的字节流的起始序号必须在连接建立时设置.首部中的序号字段值则指的是本报文段所发送的数 ...
- 僵尸进程(zombie process)
首先了解一下linux中进程的5大状态: R Running or runnable (on run queue)S Interruptible sleep (waiting for an event ...
- 大batch任务对structured streaming任务影响
信念,你拿它没办法,但是没有它你什么也做不成.—— 撒姆尔巴特勒 前言 对于spark streaming而言,大的batch任务会导致后续batch任务积压,对于structured streami ...
- 学习Vue第二节,v-cloak,v-text,v-html,v-bind,v-on使用
v-cloak,v-text,v-html,v-bind,v-on使用 <!DOCTYPE html> <html> <head> <meta charset ...
- WPF客户端自动升级
实现原理:通过一个辅助程序(更新程序.exe)比较本地版本号和服务器的版本,若服务器版本新则通过更新程序.exe下载服务器上资源(我是把最新的文件压缩成zip放到服务器上)到本地进行替换. 服务器放置 ...
- 自定义比较器(IComparer接口的实现)
class FileNameSort : IComparer { [System.Runtime.InteropServices.DllImport("Shlwapi.dll", ...
- Listener:监听器
目录 Listener概述 ServletContextListener Listener概述 web的三大组件之一 Servlet.Filter.Listener 事件监听机制 事件:一件事情 事件 ...
- java ->EL技术&JSTL技术
EL技术 EL 表达式概述 EL(Express Lanuage)表达式可以嵌入在jsp页面内部,减少jsp脚本的编写,EL出现的目的是要替代jsp页面中脚本(java代码)的编写. EL从域中取出数 ...
- 学习笔记:平衡树-splay
嗯好的今天我们来谈谈cosplay splay是一种操作,是一种调整二叉排序树的操作,但是它并不会时时刻刻保持一个平衡,因为它会根据每一次操作把需要操作的点旋转到根节点上 所谓二叉排序树,就是满足对树 ...