c++ 运用结构体,录入学生姓名年龄性别成绩等信息,用new申请内存,用一个子函数input输入,display输出
1条回答 默认 最新
- dut小冯 2019-12-01 20:11关注
#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;
}解决 7无用 5
悬赏问题
- ¥15 vue中我代理了iframe,iframe却走的是路由,没有显示该显示的网站,这个该如何处理
- ¥15 操作系统相关算法中while();的含义
- ¥15 CNVcaller安装后无法找到文件
- ¥15 visual studio2022中文乱码无法解决
- ¥15 关于华为5g模块mh5000-31接线问题
- ¥15 keil L6007U报错
- ¥15 webapi 发布到iis后无法访问
- ¥15 初学者如何快速上手学习stm32?
- ¥15 如何自动更换布娃娃图片上的衣服
- ¥15 心理学eprime编程