无聊
来源:互联网 发布:快手未知网络连接错误 编辑:程序博客网 时间:2024/06/05 09:47
#include <iostream>#include <string>using namespace std;class pet{public: int sum(int a,int b); void show(); pet(int x, string y); ~pet(); void setage(); void setname();private: string name; int age; int adoptage;};pet::pet(int x,string y):age(x),name(y){ cout<<"开始"<<endl;}pet::~pet(){ cout<<"再见"<<endl;}int pet::sum(int a, int b){ return (a+b);}void pet::setage(){ int age; cin>>age; this->age = age;}void pet::setname(){ string name; cin>>name; this->name = name;}void pet::show(){ cout<<"请问宠物的年龄是:"<<endl; cout<<"姓名:"<<name<<endl; cout<<"年龄:"<<age<<endl;}int main(){ pet dai(18,"蛋蛋"); dai.show(); cout<<"请问您的宠物的姓名是:"<<endl; dai.setname(); cout<<"请问您的宠物的年龄是:"<<endl; dai.setage(); dai.show(); return 0;}
0 0
- 无聊
- 无聊
- 无聊
- 无聊
- 无聊...
- 无聊
- 无聊
- 无聊
- 无聊
- 无聊
- 无聊
- 无聊
- 无聊
- 无聊
- 无聊
- 无聊
- 无聊
- 无聊
- opencv安装完成,测试时出现没有为opencv_core2410d.dll加载符号问题的解决
- RoboEarth 1
- (4.3.1.15)android.app.FragmentManager 与 android.support.v4.app.FragmentManager带来的若干Error
- win2d绘制图片
- 【白书之路】UVa 202 Repeating Decimals 计算小数循环节
- 无聊
- iOS开发-------简单通讯录(UITableView和CoreData的应用)
- linux下tty,控制台,虚拟终端,串口,console(控制台终端)详解http://blog.csdn.net/liaoxinmeng/article/details/5004743
- JAVA- 学习日记-命令行运行java程序
- 使用Keychain存储用户敏感信息
- 第八篇:编译器特性:关键字property与synthesize用法
- Android 面试题 (二)
- 关于Scanner类写在循环外面抛出异常后会无限循环的问题
- 减少mssql2008数据库的ldf文件