第10周项目一-点-圆-圆柱类的设计(1)
2016-05-06 21:59
302 查看
代码;
运行测试:
/* *Copyright (c) 2016, 烟台大学计算机与控制工程学院 *All rights reserved. *文件名称:main.cpp; *作 者:岳成艳; *完成日期:2015年5月6号; *版 本 号:vc++6.0; * *问题描述:建立一个point类,包括数据成员x,y,实现需要的函数 。 *程序输入:略; *程序输出:略; */ #include<iostream> using namespace std; class Point { public: Point(double a=0,double b=0); void show_point(); double getx(){return x;} double gety(){return y;} protected: double x; double y; }; Point::Point(double a,double b) { x=a; y=b; } void Point::show_point() { cout<<"点的坐标为:"<<x<<","<<y<<endl; } int main() { Point p1(1,2); p1.show_point(); return 0; }
运行测试:
相关文章推荐
- 将按钮添加到窗体
- 窗体的使用
- 糟糕 安装失败 错误代码0xa0430721 解决方案
- hihocoder #1300 : 展胜地的鲤鱼旗 dp
- Liberty nova-api load app过程跟踪
- iOS开发之原生二维码生成
- 木化html
- HDU 2163 Palindromes
- spark中的Broadcast variables和Accumulator
- Redis的replication
- Memcache-Java-Client-Release源码阅读(之六)
- PAT-B 1037. 在霍格沃茨找零钱
- java底层知识(6)--CPU、内存
- iOS之数据加密
- linux基本命令
- Centos6.5建立本地YUM源
- 【房价网房价信息爬虫】整站40万条房价数据并行抓取,可更换抓取城市
- cookie中出现的乱码问题
- 平日小问题 (2):[Error] 'setprecision' is not a member of 'std'
- 判断回文串--递归实现