#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 ;
}

设计并测试Trapezium类 代码参考的更多相关文章

  1. 设计Person类 代码参考

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

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

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

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

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

  4. 设计Dog类 代码参考

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

  5. 设计MyTime类 代码参考

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

  6. 设计Weekday类 代码参考

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

  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. Intersection of Two Linked Lists (求两个单链表的相交结点)

    题目描述: Write a program to find the node at which the intersection of two singly linked lists begins. ...

  2. 【Spark】必须要用CDH版本的Spark?那你是不是需要重新编译?

    目录 为什么要重新编译? 步骤 一.下载Spark的源码 二.准备linux环境,安装必须软件 三.解压spark源码,修改配置,准备编译 四.开始编译 为什么要重新编译? 由于我们所有的环境统一使用 ...

  3. QtCreator MSVC 搭建 Debugger

    QtCreatorForWindows搭建Debugger QtCreator for windows选择mingw或者msvc: qt-opensource-windows-x86-msvc2015 ...

  4. VMware Centos7 NAT 无法上网的解决方法

    问题描述: VMware下CentOS7使用NAT上网方式无法连网 解决方案: 网络设置为DHCP自动获取IP 查看主机(不是虚拟机)的相关服务是否打开,主要是VMware DHCP 和VMware ...

  5. Win10系统如何分区

    前言:新买了redmibookpro 14打开此电脑后,查看到出厂时C盘分了146G其他的328G全部分到了D盘,对于平时分类比较明确的我来说这不能忍,所以开始磁盘分区. 一.右击此电脑->管理 ...

  6. JS的函数和对象二

    复习 递归,在函数内部调用自身  return 匿名函数  function(){   } 创建函数,函数表达式  var fn=function(){   } 自调用   (function(){ ...

  7. Mysql快速入门(看完这篇能够满足80%的日常开发)

    这是一篇mysql的学习笔记,整理结合了网上搜索的教程以及自己看的视频教程,看完这篇能够满足80%的日常开发了. 菜鸟教程:https://www.runoob.com/mysql/mysql-tut ...

  8. 安装OPENCTI

    应业务需求,需要安装OPENCTI.很无奈的配了一下午. 首先是安装需求: 1. Ubuntu 2. Docker version 19.03.5 + docker-compose version 1 ...

  9. gulp iconfont

    参考如下网站 https://github.com/hjzheng/CUF_meeting_knowledge_share/tree/master/2015-7-24/gulp-test-iconfo ...

  10. PAT-1079 Total Sales of Supply Chain (树的遍历)

    1079. Total Sales of Supply A supply chain is a network of retailers(零售商), distributors(经销商), and su ...