C#實(shí)現(xiàn)簡(jiǎn)單學(xué)生成績(jī)管理系統(tǒng)
本文實(shí)例為大家分享了C#實(shí)現(xiàn)學(xué)生成績(jī)管理系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下
C#作業(yè) 用循環(huán)結(jié)構(gòu)/數(shù)組實(shí)現(xiàn)
進(jìn)入啟動(dòng)頁(yè)面
管理員身份登入
用戶名:師曉峰
密碼:88481234
學(xué)生成績(jī)輸入
默認(rèn)輸入三位同學(xué)
學(xué)生成績(jī)輸出
學(xué)生成績(jī)查詢
默認(rèn)按照學(xué)號(hào)查詢
學(xué)生成績(jī)修改
學(xué)生的學(xué)號(hào)是固定不變的,通過(guò)學(xué)號(hào)定位學(xué)生。
修改功能展示
退出系統(tǒng)
using System; using System.Net.Http.Headers; namespace Dome13 { ? ? class Program ? ? { ? ? ? ? static void Main(string[] args) ? ? ? ? ?{ ? ? ? ? ? ? Console.WriteLine("********歡迎進(jìn)入啟動(dòng)界面*********"); ? ? ? ? ? ? Console.WriteLine("******系統(tǒng)名稱:曉氏工作室*******"); ? ? ? ? ? ? Console.WriteLine("******開(kāi)發(fā)人姓名:師曉峰*********"); ? ? ? ? ? ? Console.WriteLine("******開(kāi)發(fā)時(shí)間:2020-10-17*******"); ? ? ? ? ? ? if (true) ? ? ? ? ? ? { ? ? ? ? ? ? ? ? Console.WriteLine("********歡迎進(jìn)入用戶登錄頁(yè)面*********"); ? ? ? ? ? ? ? ? Console.WriteLine("請(qǐng)輸入用戶名:"); ? ? ? ? ? ? ? ? string userName = Console.ReadLine(); ? ? ? ? ? ? ? ? Console.WriteLine("請(qǐng)輸入密碼:"); ? ? ? ? ? ? ? ? string ?passWord = Console.ReadLine(); ? ? ? ? ? ? ? ? string uN = "師曉峰"; ? ? ? ? ? ? ? ? string pW = "88481234"; ? ? ? ? ? ? ? ? int count = 2; ? ? ? ? ? ? ? ? while (true) ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? if (userName == uN && passWord == pW) ? ? ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("********恭喜您登錄成功*********"); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("******歡迎進(jìn)入功能菜單欄*******"); ? ? ? ? ? ? ? ? ? ? ? ? // 1.學(xué)生成績(jī)輸入 2.學(xué)生成績(jī)輸出 3.學(xué)生成績(jī)查詢 4.學(xué)生成績(jī)修改 0.退出系統(tǒng) ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("******1.學(xué)生成績(jī)輸入*******"); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("******2.學(xué)生成績(jī)輸出*******"); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("******3.學(xué)生成績(jī)查詢*******"); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("******4.學(xué)生成績(jī)修改*******"); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("******0.退出系統(tǒng)***********"); ? ? ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? else ? ? ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? if (count > 0) ? ? ? ? ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("您輸入的用戶名或密碼錯(cuò)誤,請(qǐng)重新輸入"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("您還有{0}次機(jī)會(huì)哦!?。?, count--); ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("請(qǐng)輸入用戶名:"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? userName = Console.ReadLine(); ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("請(qǐng)輸入密碼:"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? passWord = Console.ReadLine(); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? } ? ? ? ?const int N_S = 3; ? ? ? ?string[,] student = new string[N_S ,7]; ? ? ? ?int n = int.Parse(Console.ReadLine()); ? ? ? ?while (true) ? ? ? ? ? ?{ ? ? ? ? ? ?switch (n) ? ? ? ? ? ?{ ? ? ? ? ? ?case 1: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine(" 1.學(xué)生成績(jī)輸入"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? InputStudent(student, N_S); ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? ? ? ? ? ? ? case 2: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine(" 2.學(xué)生成績(jī)輸出"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? OutStudent(student, N_S); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? case 3: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine(" 3.學(xué)生成績(jī)查詢"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("請(qǐng)輸入學(xué)號(hào):"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? string id = Console.ReadLine(); ? ? ? ? ? ? ? ? ? ? ? ? ? ? InquierStudent(student ,id); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?break; ? ? ? ? ? ? ? ? ? ? ? ? ? ? case 4: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine(" 4.學(xué)生成績(jī)修改"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("學(xué)號(hào)固定不變,按照學(xué)號(hào)查找"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("請(qǐng)輸入學(xué)號(hào):"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? string id1 = Console.ReadLine(); ? ? ? ? ? ? ? ? ? ? ? ? ? ? AmendStudent(student,id1); ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? ? ? ? ? case 0: ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine(" 0.退出系統(tǒng)"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? ? ? ? ? default: ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("您輸入的數(shù)字有誤,請(qǐng)重新輸入(0~4)"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine(); ? ? ? ? ? ? ? ? ? ? Console.WriteLine("******歡迎進(jìn)入功能菜單欄*******"); ? ? ? ? ? ? ? ? ? ? Console.WriteLine("******1.學(xué)生成績(jī)輸入*******"); ? ? ? ? ? ? ? ? ? ? Console.WriteLine("******2.學(xué)生成績(jī)輸出*******"); ? ? ? ? ? ? ? ? ? ? Console.WriteLine("******3.學(xué)生成績(jī)查詢*******"); ? ? ? ? ? ? ? ? ? ? Console.WriteLine("******4.學(xué)生成績(jī)修改*******"); ? ? ? ? ? ? ? ? ? ? Console.WriteLine("******0.退出系統(tǒng)***********"); ? ? ? ? ? ? ? ? ? ? Console.WriteLine("請(qǐng)選擇功能:"); ? ? ? ? ? ? ? ? ? ? ? n =int.Parse ( Console.ReadLine()); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ?? ? ? ? ? ? ? } ? ? ? ? ? ? ?static void InputStudent(String[,]student ,int num) ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? int temp; ? ? ? ? ? ? ? ? string strStudent; ? ? ? ? ? ? ? ? string[] strInof; ? ? ? ? ? ? ? ? Console.WriteLine("請(qǐng)輸入學(xué)生信息(以·分隔開(kāi)):學(xué)號(hào)·姓名·語(yǔ)文·數(shù)學(xué)·英語(yǔ)"); ? ? ? ? ? ? ? ? for (int i=0;i<num;i++) ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? Console.WriteLine("請(qǐng)輸入第{0}個(gè)學(xué)生的信息。",i+1); ? ? ? ? ? ? ? ? ? ? strStudent = Console.ReadLine(); ? ? ? ? ? ? ? ? ? ? strInof = strStudent.Split('·'); ? ? ? ? ? ? ? ? ?for (int j=0;j<strInof.Length;j++) ? ? ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? student[i,j] = strInof[j]; ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? Console.WriteLine(); ? ? ? ? ? ? ? ? ? ? //計(jì)算總分 ? ? ? ? ? ? ? ? ? ? temp = Convert.ToInt32(student[i,2]) + Convert.ToInt32(student[i,3]) + Convert.ToInt32(student[i,4]); ? ? ? ? ? ? ? ? ? ? student[i,5] = Convert.ToString(temp); ? ? ? ? ? ? ? ? ? ? //計(jì)算平均分 ? ? ? ? ? ? ? ? ? ? student[i,6] = string .Format ("{0:F2}",temp /3.0); ? ? ? ? ? ? ? ? } ? ? ? ? ? ? } ? ? ? ? ? ? static void OutStudent(string[,] student ,int num) ? ? ? ? ? ? { ? ? ? ? ? ? Console.WriteLine(); ? ? ? ? ? ? ? ? ? ? Console.WriteLine("**********************該學(xué)生的信息***************************"); ? ? ? ? ? ? ? ? ? ? Console.WriteLine("|------------------------------------------------------------|"); ? ? ? ? ? ? ? ? ? ? Console.WriteLine("| ? 學(xué)號(hào) ?| ?姓名 ?| ?語(yǔ)文 | ?數(shù)學(xué) | ?英語(yǔ) | ?總分 ?| 平均分 |"); ? ? ? ? ? ? ? ? ? ? Console.WriteLine("|------------------------------------------------------------|"); ? ? ? ? ? ? ? ? ? ? ?for (int i=0;i<num;i++) ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? Console.WriteLine("| {0,10} | {1,3} | {2,4} | {3,4} | {4,4} | {5,5}| ?{6,6:F2} ?|",student[i,0],student [i,1],student [i,2],student [i,3],student [i,4],student [i,5],student [i,6]); ? ? ? ? ? ? ? ? ? ? Console.WriteLine("|------------------------------------------------------------|"); ? ? ? ? ? ? ? ? } ? ? ? ? ? ? } ? ? ? ? ? ? ? static void InquierStudent(String[,]student,string ?id){ ? ? ? ? ? ? ? ? int i = 0; ? ? ? ? ? ? ? ? ?for (;i<student .Length; i++) ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? if (student[i,0]==id) ? ? ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? Console.WriteLine("**********************該學(xué)生的信息***********************"); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("|--------------------------------------------------------|"); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("| ?學(xué)號(hào) ?| 姓名 ?| 語(yǔ)文 | 數(shù)學(xué) | 英語(yǔ) | 總分 ?| ?平均分 ?|"); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("|--------------------------------------------------------|"); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("| {0,10} | {1,3} |{2,4}| {3,4} | {4,4} | {5,5}| {6,6:F2} |", student[i,0], student[i,1], student[i,2], student[i, 3], student[i,4], student[i, 5], student[i,6]); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("|--------------------------------------------------------|"); ? ? ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? if(i>=student.Length) ? ? ? ? ? ? ? ? ?{ ? ? ? ? ? ? ? ? ? ? Console.WriteLine("查詢失敗,您輸入的學(xué)號(hào)有誤?。。?!"); ? ? ? ? ? ? ? ? } ? ? ? ? ? ? } ? ? ? ? ? ? static void AmendStudent(String[,] student, string id1) ? ? ? ? ? ? { ? ? ? ? ? ? ? ? int i = 0; ? ? ? ? ? ? ? ? for (; i < student.Length; i++) ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? if (student[i, 0] == id1) ? ? ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ?Console.WriteLine("**************************該學(xué)生的信息**********************"); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("|----------------------------------------------------------|"); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("| 學(xué)號(hào) ?| 姓名 ?| ?語(yǔ)文 | ?數(shù)學(xué) ?| 英語(yǔ) ?| ?總分 | 平均分 ?|"); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("|----------------------------------------------------------|"); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("|{0,10} | {1,3} | {2,4} | {3,4} ?| {4,4} | {5,5} | {6,6:F2}|", student[i,0], student[i,1], student[i,2], student[i,3], student[i,4], student[i,5], student[i,6]); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("|----------------------------------------------------------|"); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine(); ? ? ? ? ? ? ? ? ? ? ? ? int temp = 0; ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("-------------------------"); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("******1.修改姓名*********"); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("******2.修改語(yǔ)文成績(jī)*****"); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("******3.修改數(shù)學(xué)成績(jī)*****"); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("******4.修改英語(yǔ)成績(jī)*****"); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("******0.退出修改*********"); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("-------------------------"); ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("請(qǐng)輸入要修改的選項(xiàng)(對(duì)應(yīng)的序號(hào))"); ? ? ? ? ? ? ? ? ? ? ? ? int j = int.Parse(Console.ReadLine()); ? ? ? ? ? ? ? ? ? ? ? ? while (j != 0) ? ? ? ? ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? ? ? switch (j) ? ? ? ? ? ? ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? case 1: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Console.WriteLine("請(qǐng)輸入修改后的姓名:"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? student[i, 1] = Console.ReadLine(); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?case 2: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("請(qǐng)輸入修改后的語(yǔ)文:"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? student[i, 2] = Console.ReadLine(); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? case 3: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("請(qǐng)輸入修改后的數(shù)學(xué):"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? student[i, 3] = Console.ReadLine(); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? case 4: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("請(qǐng)輸入修改后的英語(yǔ):"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? student[i, 4] = Console.ReadLine(); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? case 0: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("******0.退出修改*********"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? default: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("您輸入的序號(hào)錯(cuò)誤,請(qǐng)重新輸入"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?} ? ? ? ? ? ? ? ? ? ? ? ? ? ?Console.WriteLine("請(qǐng)輸入要修改的選項(xiàng)(對(duì)應(yīng)的序號(hào)1`4)"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? j = int.Parse(Console.ReadLine()); ? ? ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? ? ? ?temp = Convert.ToInt32(student [i,2]) + Convert.ToInt32(student[i,3]) + Convert.ToInt32(student[i,4]); ? ? ? ? ? ? ? ? ? ? ? ? ? ? student[i, 5] = Convert.ToString(temp); ? ? ? ? ? ? ? ? ? ? ? ? ? ? //計(jì)算平均分 ? ? ? ? ? ? ? ? ? ? ? ? ? ? student[i, 6] = string.Format("{0:F2}", temp / 3.0); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Console.WriteLine("**********************修改侯該學(xué)生的信息***********************"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("|-------------------------------------------------------------|"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("| 學(xué)號(hào) ?| 姓名 ?| ?語(yǔ)文 | ?數(shù)學(xué) ?| 英語(yǔ) ?| 總分 ?| ? ?平均分 ?|"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("|-------------------------------------------------------------|"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("|{0,10} | {1,3} | {2,4} | ?{3,4} | {4,4} | {5,5} | ?{6,6:F2} ?|", student[i,0], student[i,1], student[i,2], student[i,3], student[i,4], student[i,5], student[i,6]); ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("|-------------------------------------------------------------|"); ? ? ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine(); ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? ? ? ? ? ? ?? ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? if (i>=student .Length ) ? ? ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("查找失敗,您輸入的學(xué)號(hào)有誤?。?!"); ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? Console.ReadKey(); ? ? ? ? ? ? ? ? } ? ? ? ? ? ? } ? ? ? ?} ? ? } }
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
.net實(shí)現(xiàn)序列化與反序列化實(shí)例解析
這篇文章主要介紹了.net實(shí)現(xiàn)序列化與反序列化實(shí)例解析,需要的朋友可以參考下2014-08-08C#WinForm實(shí)現(xiàn)多語(yǔ)言切換的示例
本文主要介紹了C#WinForm實(shí)現(xiàn)多語(yǔ)言切換的示例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2023-01-01使用 BenchmarkDotNet 對(duì) C# 代碼進(jìn)行基準(zhǔn)測(cè)試
這篇文章主要介紹了使用 BenchmarkDotNet 對(duì) C# 代碼進(jìn)行基準(zhǔn)測(cè)試,幫助大家更好的理解和學(xué)習(xí)使用c#,感興趣的朋友可以了解下2021-03-03C#中is,as,using關(guān)鍵字的使用說(shuō)明
這篇文章主要介紹了C#中is,as,using關(guān)鍵字的使用說(shuō)明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-12-12