对象数组
来源:互联网 发布:关于知乎的诗词 编辑:程序博客网 时间:2024/06/06 23:26
#include<iostream>using namespace std;class Point { public: Point() : _x(0), _y(0) {};Point(int x, int y) : _x(x), _y(y) {};~Point() {};void setX(int x){ _x = x; }void setY(int y){ _y = y; }int getX() const { return _x; }int getY() const { return _y; }private: int _x, _y;};int main(){Point *ptr=new Point[5];for(int i=0;i<5;i++){int xx,yy;cin>>xx>>yy;ptr[i].setX(xx),ptr[i].setY(yy);cout<<ptr[i].getX()<<'\t'<<ptr[i].getY()<<endl;;}delete []ptr;return 0;}
0 0
- 对象数组
- 对象数组
- 对象数组
- 对象数组
- 数组对象
- 对象数组
- 数组对象
- 对象数组
- 对象数组
- 对象数组
- 对象数组
- 对象数组
- 数组对象
- 对象数组
- 对象数组
- 对象数组
- 对象数组
- 对象数组
- iOS如何上传代码到Github
- 三种ViewController跳转的异同(两种转场动画的实现待总结)
- 【Linux学习】epoll详解
- ZooKeeper的工作流程
- UVa 679 Dropping Balls
- 对象数组
- 在 Linux 中永久修改 USB 设备权限
- matlab分割字符串(split)
- 表单提交小结
- 如何保护我的站点免受SQL入攻击——常见网站攻击手段原理与防御
- 对事务的支持
- python-MySQL学习笔记-第三章-利用Connector/Python来插入数据
- CentOS 7.0安装Zimbra 8.6邮件服务器
- ggplot2-绘制散点图