第十一周项目实践1————点类设计
2016-05-05 09:12
441 查看
问题及代码:
运行结果:
/*copyright(c)2016.烟台大学计算机学院 * All rights reserved, * 文件名称:text.Cpp * 作者:吴敬超 * 完成日期:2016年5月4日 * 版本号:codeblock * * 问题描述: 点类设计 * 输入描述: * 程序输出: 输出结果 */ #include<iostream> using namespace std; class Point { public: Point(double x=0,double y=0); double getX() { return x; } double getY() { return y; } void setpoint(double,double); void show(); private: double x; double y; }; Point::Point(double x,double y) { this->x=x; this->y=y; } void Point::setpoint(double x,double y) { this->x=x; this->y=y; } void Point::show() { cout<<"该点坐标为"<<x<<","<<y<<endl; } int main() { Point point(5.5,2.3); point.show(); point.setpoint(9.6,7.3); point.show(); return 0; }
运行结果:
相关文章推荐
- 存储过程
- java Map及Map.Entry详解
- Apache Spark在SnappyData支持即时SQL分析
- Lua从入门到放弃--异常处理
- JDBC
- Java设计代理模式之代理模式(Proxy Pattern)
- HTML-表格与表单
- Chapter 2 C#语句---异常语句
- NoSql之深入浅出redis
- 专题三 Problem N
- 如何上传织梦做的网站
- linux命令大全(1)
- 金融数据安全
- Single Number III
- 近期文档阅读计划
- c++实验5——项目1:数组分离
- 一行代码实现java list去重
- freemarker 内容
- HTTPS 使用成本
- js--异步编程的4种方法