Problem C: 平面上的点和线——Point类、Line类 (III)
Description
Input
输入的第一行为N,表示后面有N行测试样例。每行为两组坐标“x,y”,分别表示线段起点和终点的x坐标和y坐标,两组坐标间用一个空格分开,x和y的值都在double数据范围内。
Output
Sample Input
Sample Output
HINT
Append Code
int main(){    char c;    int num, i;    double x1, x2, y1, y2;    Point p(1, -2), q(2, -1), t;    t.show();    std::cin>>num;    for(i = 1; i <= num; i++)    {        std::cout<<"=========================\n";        std::cin>>x1>>c>>y1>>x2>>c>>y2;        Line line(x1, y1, x2, y2);        line.show();    }    std::cout<<"=========================\n";    Line l1(p, q), l2(p, t), l3(q, t), l4(t, q);    l1.show();    l2.show();    l3.show();    l4.show();}#include <iostream>using namespace std;class Point{    double x,y;    friend class Line;    public:    Point(double xx=0,double yy=0):x(xx),y(yy)    {        cout<<"Point : ("<<x<<", "<<y<<") is created."<<endl;    }    ~Point()    {        cout<<"Point : ("<<x<<", "<<y<<") is erased."<<endl;    }    void show()    {        cout<<"Point : ("<<x<<", "<<y<<")"<<endl;    }    Point(const Point  & pl )    {        x=pl.x;        y=pl.y;        cout<<"Point : ("<<x<<", "<<y<<") is copied."<<endl;    }};class Line{    Point p1,p2;friend class Point;    public:        Line(double x1,double x2,double x3,double x4):p1(x1,x2),p2(x3,x4)        {            cout<<"Line : ("<<x1<<", "<<x2<<") to ("<<x3<<", "<<x4<<") is created."<<endl;        }        Line(Point &p,Point &q):p1(p),p2(q)        {            cout<<"Line : ("<<p1.x<<", "<<p1.y<<") to ("<<p2.x<<", "<<p2.y<<") is created."<<endl;        }        ~Line()        {            cout<<"Line : ("<<p1.x<<", "<<p1.y<<") to ("<<p2.x<<", "<<p2.y<<") is erased."<<endl;        }        void show()        {            cout<<"Line : ("<<p1.x<<", "<<p1.y<<") to ("<<p2.x<<", "<<p2.y<<")"<<endl;        }};int main(){    char c;    int num, i;    double x1, x2, y1, y2;    Point p(1, -2), q(2, -1), t;    t.show();    std::cin>>num;    for(i = 1; i <= num; i++)    {        std::cout<<"=========================\n";        std::cin>>x1>>c>>y1>>x2>>c>>y2;        Line line(x1, y1, x2, y2);        line.show();    }    std::cout<<"=========================\n";    Line l1(p, q), l2(p, t), l3(q, t), l4(t, q);    l1.show();    l2.show();    l3.show();    l4.show();}Problem C: 平面上的点和线——Point类、Line类 (III)的更多相关文章
- Problem E: 平面上的点和线——Point类、Line类 (V)
		
Description 在数学上,平面直角坐标系上的点用X轴和Y轴上的两个坐标值唯一确定,两点确定一条线段.现在我们封装一个“Point类”和“Line类”来实现平面上的点的操作. 根据“append ...
 - Problem D: 平面上的点和线——Point类、Line类 (IV)
		
Description 在数学上,平面直角坐标系上的点用X轴和Y轴上的两个坐标值唯一确定,两点确定一条线段.现在我们封装一个“Point类”和“Line类”来实现平面上的点的操作. 根据“append ...
 - Problem B: 平面上的点和线——Point类、Line类 (II)
		
Description 在数学上,平面直角坐标系上的点用X轴和Y轴上的两个坐标值唯一确定,两点确定一条线段.现在我们封装一个“Point类”和“Line类”来实现平面上的点的操作. 根据“append ...
 - Problem A: 平面上的点和线——Point类、Line类 (I)
		
Description 在数学上,平面直角坐标系上的点用X轴和Y轴上的两个坐标值唯一确定,两点确定一条线段.现在我们封装一个“Point类”和“Line类”来实现平面上的点的操作. 根据“append ...
 - Problem F: 平面上的点——Point类 (VI)
		
Description 在数学上,平面直角坐标系上的点用X轴和Y轴上的两个坐标值唯一确定.现在我们封装一个“Point类”来实现平面上的点的操作. 根据“append.cc”,完成Point类的构造方 ...
 - Problem E: 平面上的点——Point类 (V)
		
Description 在数学上,平面直角坐标系上的点用X轴和Y轴上的两个坐标值唯一确定.现在我们封装一个“Point类”来实现平面上的点的操作. 根据“append.cc”,完成Point类的构造方 ...
 - Problem D: 平面上的点——Point类 (IV)
		
Description 在数学上,平面直角坐标系上的点用X轴和Y轴上的两个坐标值唯一确定.现在我们封装一个“Point类”来实现平面上的点的操作. 根据“append.cc”,完成Point类的构造方 ...
 - Problem C: 平面上的点——Point类 (III)
		
Description 在数学上,平面直角坐标系上的点用X轴和Y轴上的两个坐标值唯一确定.现在我们封装一个“Point类”来实现平面上的点的操作. 根据“append.cc”,完成Point类的构造方 ...
 - Problem B: 平面上的点——Point类 (II)
		
Description 在数学上,平面直角坐标系上的点用X轴和Y轴上的两个坐标值唯一确定.现在我们封装一个“Point类”来实现平面上的点的操作. 根据“append.cc”,完成Point类的构造方 ...
 
随机推荐
- 搭建openstack环境时出现的问题
			
penstack环境搭建程度(安装完keystone) 然后运行 openstack domain create --description "An Example Domain" ...
 - Http 状态码:
			
消息 100 Continue 101 Switching Protocols 102 Processing 成功 200 OK 201 Created 202 Accepted 203 Non-Au ...
 - DAY18 常用模块(二)
			
一.随机数:RANDOM 1.(0,1)小数:random.random() 2.[1,10]整数:random.randint(1,10) 3.[1,10)整数:random.randrang(1, ...
 - postgres 11 单实例最大支持多少个database?
			
有人在pg8时代(10年前)问过,当时说10000个没问题,而且每个db会在/base下建立1个文件夹, 文件ext3只支持32000个子文件夹,所以这是上限了. 而现在早就ext4了,根本没有限制了 ...
 - mybatis 动态添加表,查看表,添加数据
			
1.动态添加表 mapper int dropExistTable(@Param("tableName") String tableName);//自动创建数据表 映射文件 < ...
 - Lab 10-2
			
The file for this lab is Lab10-02.exe. Questions and Short Answers Does this program create any file ...
 - vmware虚拟机安装vmware tools
			
为了在主机与虚拟机之间共享文件,需要安装vmware tools.在安装vmware tools的过程中遇到了几个坑,在此记录一下. 一.虚拟机关机情况下进行设置.虚拟机->设置->CD/ ...
 - 手动脱壳—dump与重建输入表(转)
			
文章中用到的demo下载地址: http://download.csdn.net/detail/ccnyou/4540254 附件中包含demo以及文章word原稿 用到工具: Ollydbg Lor ...
 - Google Analytics电子商务篇(Universal版)
			
Google Analytics是一款用于统计分析网站流量.浏览行为,可用于衡量用户与您网站的互动情况的全新方式.最近刚接触不久,发现其功能真的十分强大,记录下电子商务配置方法.(新手,老鸟勿喷) G ...
 - 局域网内Ping不通
			
局域网ping不通, 原来不可忽视这步......... 通常,经常在局域网里面,为了检测网络是否顺畅,都会ping一下IP,如果网络正常,就可以上网或者远程处理其他故障.但是会出现ping别人的主机 ...