學生成績管理系統(Python學習

2021-10-08 02:13:55 字數 1217 閱讀 4635

import json

while true:

print("命令0:退出系統!")

print("命令1:填入學生成績:")

print("命令2:檢視學生成績:")

order = input("請輸入你要操作的命令:")

if order == "0":

print("退出系統成功!")

break

elif order == "1":

while true:

dict = {}

name = input("請輸入姓名:")

classroom = input("請輸入班級:")

yuwen = input("請輸入語文成績:")

shuxue = input("請輸入數學成績:")

yingyu = input("請輸入英語成績:")

dict["姓名"] = name

dict["班級"] = classroom

dict["語文成績"] = yuwen

dict["數學成績"] = shuxue

dict["英語成績"] = yingyu

json_dict = str(dict)

with open("students.txt", "a") as f:

f.write(json_dict + "\n")

result = input("是否繼續錄入學生成績(y/n):")

if result == "y":

try:

with open("students.txt", "a") as f:

f.write(json_dict + "\n")

print("填寫資訊成功")

except exception as e:

with open("logger.txt", "a") as f:

f.write("報錯資訊詳情:", + e)

print("填寫失敗,請重新填寫")

elif result == "n":

break

else:

print("操作命令有誤,請重新輸入")

elif order == "2":

with open("students.txt", "r") as f:

print(f.read())

else:

print("命令輸入有誤,請重新輸入")

學生成績管理系統

include include include define n 50 定義符號常量,代表學生人數最大值 int count 0 全域性變數,用於記錄陣列的當前位置 struct student 定義結構體型別,代表學生資訊 void input struct student arr 函式宣告,輸入...

學生成績管理系統

include include include include include include include include define null 0 define esc 0x001b 退出 define f1 0x3b00 檢視幫助資訊,呼叫helpmassage 函式 define f2 ...

學生成績管理系統

這是進入大學以來,第一次做的c語言課程設計,覺得挺有意義,把 貼上來,曬一下!學生成績管理系統 教師,管理員密碼 輸入學生的基本資訊 輸出學生的基本資訊 查詢學生的基本資訊 學生成績分析 排序 統計 退出 include include include include include include...