写的满头大汗,太繁琐了,实属不易。
___: '内部变量定义'
student1_name: '空'
student1_id: '空'
student2_name: '空'
student2_id: '空'
student3_name: '空'
student3_id: '空'
student4_name: '空'
student4_id: '空'
student5_name: '空'
student5_id: '空'
___: '子程序定义'
__: '主菜单'
root_menu :: 17
put '=' * 40 + '\n'
put '欢迎使用学生管理系统!\n'
put '-' * 40 + '\n'
put '(a)查看学生\n'
put '(b)添加学生\n'
put '(c)删除学生\n'
put '(d)退出系统\n'
put '=' * 40 + '\n'
put '\n'
key_time :: 27
put '选择你的操作:'
ipt key
key == '' -> key_time
key == 'd' -> quit
key == 'a' -> read
key == 'b' -> add
key == 'c' -> detele
put '无效的命令。\n'
-> key_time
__: '查看学生'
read :: 39
put '-' * 40 + '\n'
student1_name == '空' -> read_done
put student1_name + ':' + student1_id + '\n'
student2_name == '空' -> read_done
put student2_name + ':' + student2_id + '\n'
student3_name == '空' -> read_done
put student3_name + ':' + student3_id + '\n'
student4_name == '空' -> read_done
put student4_name + ':' + student4_id + '\n'
student5_name == '空' -> read_done
put student5_name + ':' + student5_id + '\n'
read_done :: 51
put '-' * 40 + '\n'
put '\n'
-> key_time
__: '添加学生'
add :: 58
put '-' * 40 + '\n'
student1_name != '空' -> add_done1
put '输入学生姓名:'
ipt student1_name
put '输入学生学号:'
ipt student1_id
-> add_done_main
add_done1 :: 68
student2_name != '空' -> add_done2
put '输入学生姓名:'
ipt student2_name
put '输入学生学号:'
ipt student2_id
-> add_done_main
add_done2 :: 76
student3_name != '空' -> add_done3
put '输入学生姓名:'
ipt student3_name
put '输入学生学号:'
ipt student3_id
-> add_done_main
add_done3 :: 84
student4_name != '空' -> add_done4
put '输入学生姓名:'
ipt student4_name
put '输入学生学号:'
ipt student4_id
-> add_done_main
add_done4 :: 92
student5_name != '空' -> add_done5
put '输入学生姓名:'
ipt student5_name
put '输入学生学号:'
ipt student5_id
-> add_done_main
add_done5 :: 100
put '没有空间录入了,请删除多余学生。\n'
-> add_done_main
add_done_main :: 104
put '-' * 40 + '\n'
put '\n'
-> key_time
__: '删除学生'
detele :: 111
put '-' * 40 + '\n'
put '要删除第( )位学生:'
ipt key
key == '1' -> detele1
key == '2' -> detele2
key == '3' -> detele3
key == '4' -> detele4
key == '5' -> detele5
-> detele_else
detele1 :: 122
student1_name: '空'
student1_id: '空'
-> detele_done
detele2 :: 127
student2_name: '空'
student2_id: '空'
-> detele_done
detele3 :: 132
student3_name: '空'
student3_id: '空'
-> detele_done
detele4 :: 137
student4_name: '空'
student4_id: '空'
-> detele_done
detele5 :: 142
student5_name: '空'
student5_id: '空'
-> detele_done
detele_else :: 147
put '没有这个部分\n'
-> detele_done
detele_done :: 151
put '-' * 40 + '\n'
put '\n'
-> key_time
__: '退出系统'
quit :: 158
run