c++学生信息管理系统
时间: 2023-06-11 12:08:35 浏览: 61
学生信息管理系统是一个常见的应用程序,用于管理学生的个人信息、课程信息、成绩信息等。以下是一个简单的 C 语言实现的学生信息管理系统的例子:
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct student {
char name[20];
int age;
char gender[8];
char id[15];
float score;
};
int main() {
int n;
printf("请输入学生人数:");
scanf("%d", &n);
struct student *students = (struct student*)malloc(n * sizeof(struct student));
for (int i = 0; i < n; i++) {
printf("请输入第 %d 个学生的信息:\n", i+1);
printf("姓名:");
scanf("%s", students[i].name);
printf("年龄:");
scanf("%d", &students[i].age);
printf("性别:");
scanf("%s", students[i].gender);
printf("学号:");
scanf("%s", students[i].id);
printf("成绩:");
scanf("%f", &students[i].score);
}
printf("\n学生信息如下:\n");
printf("姓名\t年龄\t性别\t学号\t成绩\n");
for (int i = 0; i < n; i++) {
printf("%s\t%d\t%s\t%s\t%.2f\n", students[i].name, students[i].age, students[i].gender, students[i].id, students[i].score);
}
free(students);
return 0;
}
```
运行程序后,会提示输入学生人数,然后依次输入每个学生的信息。最后程序会输出所有学生的信息。这只是一个简单的例子,实际应用中可能需要更复杂的功能,比如添加、删除、修改学生信息,以及进行查询和统计等操作。
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![](https://img-home.csdnimg.cn/images/20210720083646.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)