比这篇新的文章:
Codee#2327
比这篇旧的文章: Codee#2325
作者: 邓晓华, 点击130次, 评论(0), 收藏者(0), , 打分:
所有评论,共0条:( 我也来说两句)
比这篇旧的文章: Codee#2325
Codee#2326
语言: C++, 标签: 无 2009/06/22发布 9个月前更新作者: 邓晓华, 点击130次, 评论(0), 收藏者(0), , 打分:
C++语言: Codee#2326
01 #include <iostream>
02
03 using namespace std;
04
05 class Dog
06 {
07 private:
08 int age;
09 float weight;
10
11 public:
12 int setAge(int a)
13 {
14 age = a;
15 }
16 float setWeight(float w);
17 void show()
18 {
19 cout << "The age = " << age << endl
20 << "The weight = " << weight << endl;
21 }
22 };
23
24 float Dog :: setWeight(float w)
25 {
26 weight = w;
27 }
28
29 int main(void)
30 {
31 Dog d1;
32
33 d1.setAge(22);
34 d1.setWeight(100);
35 d1.show();
36 return 0;
37 }
02
03 using namespace std;
04
05 class Dog
06 {
07 private:
08 int age;
09 float weight;
10
11 public:
12 int setAge(int a)
13 {
14 age = a;
15 }
16 float setWeight(float w);
17 void show()
18 {
19 cout << "The age = " << age << endl
20 << "The weight = " << weight << endl;
21 }
22 };
23
24 float Dog :: setWeight(float w)
25 {
26 weight = w;
27 }
28
29 int main(void)
30 {
31 Dog d1;
32
33 d1.setAge(22);
34 d1.setWeight(100);
35 d1.show();
36 return 0;
37 }
所有评论,共0条:( 我也来说两句)
代码
