c语言,无返回值的自定义函数及其主函数调用。1.信息修改模块:对于权限判断,若为有权限老师,则允许修改学生的状态,包括在籍,休学,结业,毕业,若为无权限普通老师,则禁止修改学生的状态。2.信息导出模块:将指定查询到的信息导出到任意文件中
时间: 2024-06-11 13:06:50 浏览: 10
。#include <stdio.h>
// 信息修改模块
void modify_student_status(int is_teacher, int student_id, int new_status) {
if (is_teacher) {
printf("修改学生 %d 的状态为 %d\n", student_id, new_status);
} else {
printf("您没有权限修改学生的状态\n");
}
}
// 信息导出模块
void export_info_to_file(int student_id, char* file_path) {
printf("将学生 %d 的信息导出到文件 %s 中\n", student_id, file_path);
}
int main() {
int is_teacher = 1; // 有权限老师
int student_id = 123;
int new_status = 2; // 休学状态
modify_student_status(is_teacher, student_id, new_status);
is_teacher = 0; // 普通老师没有权限修改
modify_student_status(is_teacher, student_id, new_status);
char* file_path = "student_info.txt";
export_info_to_file(student_id, file_path);
return 0;
}
相关推荐
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_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)
![](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)