#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. Spring MVC的Controller接受请求方式以及编写请求处理方法

    Controller接受请求参数的常见方法: 1.通过Bean接受请求参数: 创建POJO实体类 创建pojo包,并在该包中创建实体类UserForm,代码: package pojo; public ...

  2. async与await----js的异步处理

    async与await----js的异步处理 博客说明 文章所涉及的资料来自互联网整理和个人总结,意在于个人学习和经验汇总,如有什么地方侵权,请联系本人删除,谢谢! 说明 之前写代码遇到一个问题,返回 ...

  3. maven的安装及环境变量配置

    1.下载maven 2.解压至该路径 3. 新建环境变量MAVEN_HOME , 值为maven包点开路径 环境变量配置: 4. 编辑环境变量Path,追加%MAVEN_HOME%\bin\ 5.一路 ...

  4. oracle常用数学函数

    数学函数 ABS:(返回绝对值) --返回绝对值 select abs(-1.11) from dual; CEIL:(向上取整) --向上取整 select ceil(3.1415) from du ...

  5. LeetCode--LinkedList--160. Intersection of Two Linked Lists(Easy)

    160. Intersection of Two Linked Lists(Easy) 题目地址https://leetcode.com/problems/intersection-of-two-li ...

  6. LeetCode--Unique Email Addresses & Hamming Distance (Easy)

    929. Unique Email Addresses (Easy)# Every email consists of a local name and a domain name, separate ...

  7. 一个数number的n次幂 python的pow函数

    @ 目录 解法1:暴力法 解法2:根据奇偶幂分类(递归法,迭代法,位运算法) 实现 pow(x, n),即计算 x 的 n 次幂函数.其中n为整数. 链接: pow函数的实现--leetcode. 解 ...

  8. 一文教你快速学会在matlab的simulink中调用C语言进行仿真

    本文介绍如何在matlab的simulink中嵌入C语言进行多输入多输出的仿真:matlab版本位2015b: 创作不易,如果本文帮到了您: 如果本文帮到了您,请帮忙点个赞

  9. 【STM32系列汇总】小白博主的STM32实战快速进阶之路(持续更新)

    我把之前在学习和工作中使用STM32进行嵌入式开发的经验和教程等相关整理到这里,方便查阅学习,如果能帮助到您,请帮忙点个赞: 本文的宗旨 STM32 只是一个硬件平台,同样地他可以换成MSP430,N ...

  10. ARM-Linux Gcc 交叉编译环境搭建

    1 NFS网络文件系统搭建 测试宿主机与目标板ping通 目标板上某个文件夹(例如mnt)挂载到宿主机(192.168.1.111)的/home/nfs_dir文件夹下 mount –t nfs –o ...