文件名称:2.1
介绍说明--下载内容均来自于网络,请自行研究使用
编写C++程序完成以下功能:
(1) 定义一个Point类,其属性包括点的坐标,提供计算两点之间距离的方法;
(2) 定义一个矩形类,其属性包括左上角和右下角两个点,提供计算面积的方法;
(3) 创建一个矩形对象,提示用户输入矩形左上角和右下角的坐标;
(4) 观察矩形对象以及Point类成员的构造函数与析构函数的调用;
(5) 计算其面积,并输出。
-Write C++ program performs the following functions: (1) defines a Point class, its properties include the coordinates of points, providing methods of calculating the distance between two points (2) define a rectangle class, its properties include the two top left and bottom right corner points, provided the method calculates the area (3) create a rectangle object, the user is prompted top left and bottom right coordinates of the rectangle (4) observed a rectangular object, and a member of the Point class constructor and destructor calls (5 ) to calculate the area and output.
(1) 定义一个Point类,其属性包括点的坐标,提供计算两点之间距离的方法;
(2) 定义一个矩形类,其属性包括左上角和右下角两个点,提供计算面积的方法;
(3) 创建一个矩形对象,提示用户输入矩形左上角和右下角的坐标;
(4) 观察矩形对象以及Point类成员的构造函数与析构函数的调用;
(5) 计算其面积,并输出。
-Write C++ program performs the following functions: (1) defines a Point class, its properties include the coordinates of points, providing methods of calculating the distance between two points (2) define a rectangle class, its properties include the two top left and bottom right corner points, provided the method calculates the area (3) create a rectangle object, the user is prompted top left and bottom right coordinates of the rectangle (4) observed a rectangular object, and a member of the Point class constructor and destructor calls (5 ) to calculate the area and output.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
2.1.cpp