码迷,mamicode.com
首页 > 编程语言 > 详细

C++类应用

时间:2016-05-08 11:55:00      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:

 1 #include<stdio.h>
 2 class Student
 3 {
 4 public:
 5     char *names;
 6     int age;
 7     float weight;
 8 public:void say()
 9     {
10         printf_s("%s的年龄是%d体重是%f", names, age, weight);
11     }
12 };
13 int main()
14 {
15     Student stu;
16     stu.names = "xiaoming"; 
17     stu.age = 17;
18     stu.weight = 60.3;
19     stu.say();
20     getchar();
21     return 0;
22 }

 

C++类应用

标签:

原文地址:http://www.cnblogs.com/releed/p/5470105.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!