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)頁面

管理員身份登入
用戶名:師曉峰
密碼:88481234

學(xué)生成績(jī)輸入
默認(rèn)輸入三位同學(xué)

學(xué)生成績(jī)輸出

學(xué)生成績(jī)查詢
默認(rèn)按照學(xué)號(hào)查詢

學(xué)生成績(jī)修改
學(xué)生的學(xué)號(hào)是固定不變的,通過學(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("******開發(fā)人姓名:師曉峰*********");
? ? ? ? ? ? Console.WriteLine("******開發(fā)時(shí)間:2020-10-17*******");
? ? ? ? ? ? if (true)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("********歡迎進(jìn)入用戶登錄頁面*********");
? ? ? ? ? ? ? ? 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é)生信息(以·分隔開):學(xué)號(hào)·姓名·語文·數(shù)學(xué)·英語");
? ? ? ? ? ? ? ? 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) ?| ?姓名 ?| ?語文 | ?數(shù)學(xué) | ?英語 | ?總分 ?| 平均分 |");
? ? ? ? ? ? ? ? ? ? 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) ?| 姓名 ?| 語文 | 數(shù)學(xué) | 英語 | 總分 ?| ?平均分 ?|");
? ? ? ? ? ? ? ? ? ? ? ? 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) ?| 姓名 ?| ?語文 | ?數(shù)學(xué) ?| 英語 ?| ?總分 | 平均分 ?|");
? ? ? ? ? ? ? ? ? ? ? ? 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.修改語文成績(jī)*****");
? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("******3.修改數(shù)學(xué)成績(jī)*****");
? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("******4.修改英語成績(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)輸入修改后的語文:");
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 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)輸入修改后的英語:");
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 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) ?| 姓名 ?| ?語文 | ?數(shù)學(xué) ?| 英語 ?| 總分 ?| ? ?平均分 ?|");
? ? ? ? ? ? ? ? ? ? ? ? ? ? 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)文章
輕松學(xué)習(xí)C#的結(jié)構(gòu)和類
輕松學(xué)習(xí)C#的結(jié)構(gòu)和類,對(duì)C#的結(jié)構(gòu)和類感興趣的朋友可以參考本篇文章,幫助大家更靈活的運(yùn)用C#的結(jié)構(gòu)和類2015-11-11
Unity實(shí)現(xiàn)鼠標(biāo)或者手指點(diǎn)擊模型播放動(dòng)畫
這篇文章主要為大家詳細(xì)介紹了Unity實(shí)現(xiàn)鼠標(biāo)或者手指點(diǎn)擊模型播放動(dòng)畫,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-01-01
C#實(shí)現(xiàn)自定義ListBox背景的示例詳解
這篇文章主要為大家詳細(xì)介紹了如何利用C#實(shí)現(xiàn)自定義ListBox背景,文中的示例代碼講解詳細(xì),對(duì)我們學(xué)習(xí)C#有一定的幫助,感興趣的小伙伴可以跟隨小編一起了解一下2022-12-12
Unity的Console的控制類LogEntries深入解析與實(shí)用案例
這篇文章主要為大家介紹了Unity的Console的控制類LogEntries深入解析與實(shí)用案例,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-07-07
C# 實(shí)現(xiàn)階乘 (遞歸,非遞歸) 實(shí)現(xiàn)代碼
C# 實(shí)現(xiàn)階乘 (遞歸,非遞歸) 實(shí)現(xiàn)代碼,需要的朋友可以參考一下2013-05-05
在c#中使用servicestackredis操作redis的實(shí)例代碼
本篇文章主要介紹了在c#中使用servicestackredis操作redis的實(shí)例代碼,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-06-06

