c++结构体输入并输出学生信息

c++ 运用结构体,录入学生姓名年龄性别成绩等信息,用new申请内存,用一个子函数input输入,display输出

#include "stdafx.h"
#include
#include
#include
using namespace std;
struct Student {
string name;
int age;
string sexual;
int score;
};
void input(Student *S) {
cin >> S->name;
cin >> S->age;
cin >> S->sexual;
cin>> S->score;
}
void display(Student *S) {
cout << S->name <<"\n"<age << S->sexual <<"\n"<< S->score << endl;
}
int main()
{
Student *stu=new Student;
input(stu);
display(stu);
delete stu;
return 0;
}