1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class Trapezium
  6. {
  7. private:
  8. int x1,y1,x2,y2,x3,y3,x4,y4;
  9. public:
  10. void initial(){x1=,x2=;x3=;x4=;y1=;y2=;y3=;y4=;return;}
  11. void GetPosition(int&,int&,int&,int&,int&,int&,int&,int&);
  12. void Area()
  13. {
  14. double s;
  15. s=((x2-x1)+(x4-x3))*(y2-y4)/2.0;
  16. cout<<s<<endl;
  17. return;
  18. }
  19. };
  20.  
  21. void Trapezium::GetPosition(int& a,int& b,int& c,int& d,int& e,int& f,int& g,int& h)
  22. {
  23. x1=a;y1=b;x2=c;y2=d;x3=e;y3=f;x4=g;y4=h;
  24. return;
  25. }
  26.  
  27. int main()
  28. {
  29. int x[],y[];
  30. Trapezium one;
  31. for(int i=;i<;i++) cin>>x[i]>>y[i];
  32. one.initial();
  33. one.GetPosition(x[],y[],x[],y[],x[],y[],x[],y[]);
  34. one.Area();
  35. return ;
  36. }

设计Person类 代码参考的更多相关文章

  1. 设计Dog类 代码参考

    #include <iostream> #include <string> using namespace std; class Dog { private: string n ...

  2. 设计MyTime类 代码参考

    #include <iostream> #include <cstdio> using namespace std; class MyTime { private: int h ...

  3. 设计Weekday类 代码参考

    #include <iostream> using namespace std; class Weekday { private: int num; public: void SetDay ...

  4. 设计一个多功能的MyTime类 代码参考

    #include <iostream> #include <cstdio> using namespace std; class MyTime { private: int h ...

  5. 设计带构造函数的Dog类 代码参考

    #include <iostream> #include <string> using namespace std; class Dog { private: string n ...

  6. 设计并测试Trapezium类 代码参考

    #include <iostream> using namespace std; class Trapezium { private: int x1,y1,x2,y2,x3,y3,x4,y ...

  7. 从Student类和Teacher类多重派生Graduate类 代码参考

    #include <iostream> #include <cstring> using namespace std; class Person { private: char ...

  8. 从Point类继承的Circle类 代码参考

    #include <iostream> #include <cstring> using namespace std; class Point { private: int x ...

  9. 一个基类Person的多个派生类 代码参考

    #include <iostream> #include <cstring> using namespace std; class Person { protected: ch ...

随机推荐

  1. 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 ...

  2. TCP 可靠传输

    TCP报文段首部 序号: TCP是面向字节流的.在一个TCP连接中传送的字节流中的每一个字节都按顺序编号.整个要传送的字节流的起始序号必须在连接建立时设置.首部中的序号字段值则指的是本报文段所发送的数 ...

  3. 僵尸进程(zombie process)

    首先了解一下linux中进程的5大状态: R Running or runnable (on run queue)S Interruptible sleep (waiting for an event ...

  4. 大batch任务对structured streaming任务影响

    信念,你拿它没办法,但是没有它你什么也做不成.—— 撒姆尔巴特勒 前言 对于spark streaming而言,大的batch任务会导致后续batch任务积压,对于structured streami ...

  5. 学习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 ...

  6. WPF客户端自动升级

    实现原理:通过一个辅助程序(更新程序.exe)比较本地版本号和服务器的版本,若服务器版本新则通过更新程序.exe下载服务器上资源(我是把最新的文件压缩成zip放到服务器上)到本地进行替换. 服务器放置 ...

  7. 自定义比较器(IComparer接口的实现)

    class FileNameSort : IComparer { [System.Runtime.InteropServices.DllImport("Shlwapi.dll", ...

  8. Listener:监听器

    目录 Listener概述 ServletContextListener Listener概述 web的三大组件之一 Servlet.Filter.Listener 事件监听机制 事件:一件事情 事件 ...

  9. java ->EL技术&JSTL技术

    EL技术 EL 表达式概述 EL(Express Lanuage)表达式可以嵌入在jsp页面内部,减少jsp脚本的编写,EL出现的目的是要替代jsp页面中脚本(java代码)的编写. EL从域中取出数 ...

  10. 学习笔记:平衡树-splay

    嗯好的今天我们来谈谈cosplay splay是一种操作,是一种调整二叉排序树的操作,但是它并不会时时刻刻保持一个平衡,因为它会根据每一次操作把需要操作的点旋转到根节点上 所谓二叉排序树,就是满足对树 ...