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 }
时间: 2024-12-28 01:08:01