#include<iostream>
using namespace std;
class Coordinate //定义Coordinate类
{
private:
int times; //存放输入坐标数目
float Coord[100][100]; //存放输入坐标的数组
public:
Coordinate() //设置默认的输入坐标数目
{
times = 2;
cout << "Coordinate construction1 called!" << endl;
}
Coordinate(int times1) //设置输入坐标数目
{
times = times1;
cout << "Coordinate constructin2 called!" << endl;
}
~Coordinate() //析构函数
{
cout << "Coordinate destruction called!" << endl;
}
void InputCoord() //输入坐标
{
for (int i = 0; i < times; i++)
{
cout << "Please Input x:" << endl;
cin >> Coord[i][1];
cout << "Please Input y:" << endl;
cin >> Coord[i][2];
}
}
void ShowCoord() //显示已经输入的坐标
{
cout << "The coord is:" << endl;
for (int i = 0; i < times; i++)
{
cout << "(" << Coord[i][1] &
C++ 3.1 Coordinate
于 2022-10-23 16:30:17 首次发布