/*
*copvriqht(c)2016,烟台大学计算机学院
*All rights reserved.
*文件名称:test.cpp
*作者:陈传祯
*完成日期:2016年6月13日
*版本号:v1.0
*
*问题描述
*输入描述
*程序输出
class Point
{
public:
Point(double x=0,double y=0);//构造函数
void setPoint(double,double);//设置坐标值
double getX()const{return x;}
double getY()const {return y;}
void show();
protected:
double x,y;
};
Point::Point(double a,double b)
{
x=a;
y=b;
}
void Point::setPoint(double a,double b)
{
x=a;
y=b;
}
void Point::show()
{
cout<<"["<<x<<","<<y<<"]"<<endl;
}
int main()
{
Point p(5,6);
p.show();
p.setPoint(7.5,48);
p.show();
return 0;
}
*copvriqht(c)2016,烟台大学计算机学院
*All rights reserved.
*文件名称:test.cpp
*作者:陈传祯
*完成日期:2016年6月13日
*版本号:v1.0
*
*问题描述
*输入描述
*程序输出
*/
#include <iostream>
using namespace std;class Point
{
public:
Point(double x=0,double y=0);//构造函数
void setPoint(double,double);//设置坐标值
double getX()const{return x;}
double getY()const {return y;}
void show();
protected:
double x,y;
};
Point::Point(double a,double b)
{
x=a;
y=b;
}
void Point::setPoint(double a,double b)
{
x=a;
y=b;
}
void Point::show()
{
cout<<"["<<x<<","<<y<<"]"<<endl;
}
int main()
{
Point p(5,6);
p.show();
p.setPoint(7.5,48);
p.show();
return 0;
}