Problem A: 第一个类
2017-05-14 12:06
204 查看
Home | Web Board | ProblemSet | Standing | Status | Statistics |
Problem A: 第一个类
Time Limit: 1 Sec Memory Limit:128 MB
Submit: 730 Solved: 669
[Submit][Status][Web
Board]
Description
定义一个Thing类,只有1个字符串属性name,定义其构造函数和析构函数,分别输出样例所示的内容。Input
一个不包含空白符的字符串。Output
见样例。Sample Input
TruckSample Output
Construct a thing CarConstruct a thing TruckDestroy a thing TruckDestroy a thing CarHINT
Append Code
append.cc,[Submit][Status][Web
Board]
한국어< 中文 فارسی English ไทย
All Copyright Reserved 2010-2011
SDUSTOJ TEAM
GPL2.0 2003-2011
HUSTOJ Project TEAM
Anything about the Problems, Please Contact Admin:admin
#include <iostream> #include <iomanip> #include <cstring> #include <cmath> using namespace std; class Thing { private: string name; public: Thing(){ } Thing(string n):name(n) {cout << "Construct a thing " << name << endl; } ~Thing(){ cout << "Destroy a thing " << name << endl;} }; int main() { Thing A("Car"); string str; cin>>str; Thing B(str); return 0; }
相关文章推荐
- 洛谷-A+B Problem-洛谷的第一个任务
- Problem Description 青年歌手大奖赛中,评委会给参赛选手打分。选手得分规则为去掉一个最高分和一个最低分,然后计算平均得分,请编程输出某选手的得分。 Input 输入数据有多组,每组占一行,每行的第一个数是n(2<n<=100),表示评委的人数,然后是n个评委的打分。 O
- [置顶]我的第一个C语言程序 (A+B Problem)(cheney-yang)
- 新手村 洛谷的第一个任务 A+B problem
- scala学习-1-eclipse编写第一个程序unknown scala version problem
- problem 12 f(n) = f(n-1) + n 数列中第一个
- A First Problem : Stable Matching(第一个重要问题:稳定匹配)
- FMS3系列(一):第一个FMS程序,连接到FMS服务器(Flash/Flex两种实现)
- 第一个python
- POJ 1298 The Hardest Problem Ever
- UVA - 11991 Easy Problem from Rujia Liu?(map)
- apache只生效第一个配置
- cf C. A Problem about Polyline (数学题)
- 记录android第一个hello world
- 详解第一个CUDA程序kernel.cu
- 两个链表的第一个公共结点
- The Blocks Problem ——Uva 101
- 今天上传了第一个资源:中国行政区划代码表及SQLServer脚本
- POJ 2535 Very Simple Problem(我的水题之路——看错题)
- A + B Problem II