设计并测试Trapezium类 代码参考
#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类 代码参考的更多相关文章
- 设计Person类 代码参考
#include <iostream> using namespace std; class Trapezium { private: int x1,y1,x2,y2,x3,y3,x4,y ...
- 设计一个多功能的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 ...
- 设计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 ...
- 从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 ...
随机推荐
- js数组中返回具有某个属性具有特定值的对象
const drDataArr = [{ date: 0, type: '心率', value: 82 },{ date: 1, type: '心率', value: 80 },{ date: 2, ...
- startUML简单使用教程
最近在startUML上画图搞得我一个头两个大,找了一些比较实用的小方法分享给大家. 类图是可视化地表现类的属性和方法,以及类与类之间的关系. 1.类 a.类 普通实体类,它有对应的属性和方法: 双击 ...
- 跟哥一起学python(3)- 理解“变量”
我们把前面的程序稍微改一下,来了解python中的变量. # file: ./4/4_1.py # 定义变量 hello_str = "hello, world!" # 字符串打印 ...
- file download hash mismatch
在linux中使用cmake时,遇到了"file download hash mismatch",同时status显示"unsupported protocol" ...
- vue.prototype和vue.use的区别和注意点
1.vue.prototype:实例上挂载属性/方法,例如Vue.prototype.axios = axios; 2.vue.use:引入插件,例如vuex,vue.use(vuex)如图,vue. ...
- C# 数据操作系列 - 0. 序言
0. 前言 在上一个系列中,我们初步浏览了一下C#的基础知识.这句话的意思就是C#基础知识系列完结了,撒花.当然,并不是因为C#已经讲完了.正是因为我们轻轻地叩开了那扇门,才能看到门后面那瑰丽的世界. ...
- Spring Cloud 学习 之 Spring Cloud Eureka(架构)
Spring Boot版本:2.1.4.RELEASE Spring Cloud版本:Greenwich.SR1 文章目录 Eureka服务治理基础架构的三个核心要素: 服务治理机制: 服务提供者: ...
- 【Hadoop离线基础总结】Hive的安装部署以及使用方式
Hive的安装部署以及使用方式 安装部署 Derby版hive直接使用 cd /export/softwares 将上传的hive软件包解压:tar -zxvf hive-1.1.0-cdh5.14. ...
- 【hdu1030】“坐标表示法”
http://acm.hdu.edu.cn/showproblem.php?pid=1030 算法:以顶点为原点,建立坐标系,一个数可以唯一对应一个三元组(x, y, z),从任意一个点出发走一步,刚 ...
- [BC冠军赛(online)]小结
A Movie 题意:给你n个区间,判断能否选出3个不相交的区间. 思路:令f(i)表示能否选出两个不相交区间并且以区间i为右区间的值,g(i)表示能否选出两个不相交区间并且以区间i为左区间的值,如果 ...