main.cpp:
#include
#include
#include"Student.h"
using namespace std;
void main()
{
int i;
Student a[3];
for(i=0;i<3;i++)
{
cin>>a[i].age>>a[i].name;
a[i].Input(a[i].age,a[i].name);
}
for(i=0;i<3;i++)
{
a[i].Output();
}
}
student.h
#pragma once
#include
#include
using namespace std;
class Student
{
public:
int age;
string name;
int Input(int a, string str);
int Output();
};
Student.cpp
#include “Student.h”
using namespace std;
#include
int Student::Input(int a, string str)
{
a=age;
str=name;
return 0;
}
int Student::Output()
{
cout<<age<<"__"<<name<<endl;
return 0;
}