/*
*Copyright (c) 2016,烟台大学计算机学院
*All rights reserved.
*文件名称 :
*作 者 : 刘默涵
*完成日期 : 2016年5月19号
*版 本 号 : v1.0
*问题描述:建立一个Point(点)类,包含数据成员x,y(坐标点),实现需要的成员函数,并设计main函数完成测试
*/
#include<iostream>
using namespace std;
class Point
{
public: Point(float i,float j):x(i),y(j){cout<<"setting successfully!!!"<<endl;}\
float getX(){return x;}
float getY(){return y;}
private: float x; float y;
};
int main()
{
Point p(1,2);
cout<<"横坐标为:"<<p.getX()<<"\n纵坐标为:"<<p.getY()<<endl;
return 0;
}
07-21
07-21
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交