#ifndef STUDENT_H
#define STUDENT_H
class Student
{
public:
Student();
void print();
protected:
private:
char name[128];
int age;
char addr[128];
};
#endif // STUDENT_H
#include "Student.h"
#include <iostream>
#include <string.h>
using namespace std;
Student::Student()
{
strcpy(name,"唐浩");
age = 23;
strcpy(addr,"上海");
}
void Student::print()
{
cout<<name<<","<<age<<","<<addr<<endl;
}
#include <iostream>
#include "Student.h"
using namespace std;
int main()
{
Student student;
student.print();
return 0;
}