当前位置:新励学网 > 秒知问答 > 求一份学生管理系统课程设计报告,数据结构课程设计

求一份学生管理系统课程设计报告,数据结构课程设计

发表时间:2024-07-11 12:56:27 来源:网友投稿

为什么要中间拿那么多空格隔开呢?逗号或“|”都比那好弄。

如果这题是老师出的,老师一定脑袋有问题。

//==============

效果图查询自己写

需要的控件

privateSystem.Windows.Forms.Buttonbutton1;privateSystem.Windows.Forms.RichTextBoxrichTextBox1;privateSystem.Windows.Forms.Buttonbutton2;privateSystem.Windows.Forms.Buttonbutton3;privateSystem.Windows.Forms.GroupBoxgroupBox1;privateSystem.Windows.Forms.RichTextBoxrichTextBox2;privateSystem.Windows.Forms.GroupBoxgroupBox2;privateSystem.Windows.Forms.GroupBoxgroupBox3;

后台

usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Text;usingSystem.IO;

namespaceWindowsFormsApplication1{publicpartialclasscj:Form{publicStreamWriterSW;publiccj(){InitializeComponent();stringHeader=姓名++学号++语文++数学++英语+\n;richTextBox1.AppendText(Header);richTextBox2.AppendText(Header);CheckDirectory();}

privatevoidbutton1_Click(objectsender,EventArgse){stringstrFile;strFile=System.Windows.Forms.Application.StartupPath+\\3.txt;OpenFileDialogopenFileDialog1=newOpenFileDialog();openFileDialog1.Filter=文本文件(*.txt)|*.txt;openFileDialog1.DefaultExt=txt;if(openFileDialog1.ShowDialog()==DialogResult.OK){stringFileName=openFileDialog1.FileName;

if(Path.GetExtension(FileName)!=.txt){MessageBox.Show(格式不对);}else{

FileStreamstream=newFileStream(openFileDialog1.FileName,FileMode.Open,FileAccess.Read);StreamReadersReader=newStreamReader(openFileDialog1.FileName,Encoding.Default);if(sReader.ReadLine().Split('\n').Length>0){richTextBox1.AppendText(sReader.ReadToEnd());}richTextBox1.AppendText(\n);

//StreamWriterssw=newSystem.IO.StreamWriter(FileName,true,System.Text.Encoding.Default);

}

}

}

privatevoidWriteLog(stringmsg){stringstrFile;strFile=System.Windows.Forms.Application.StartupPath+\\data\\3.log;//StreamWriterSW;try{SW=newSystem.IO.StreamWriter(strFile,true);

SW.WriteLine(msg);}catch(Exceptionex){WriteLog(ex.Message);}finally{SW.Flush();SW.Close();}

}

privatevoidbutton2_Click(objectsender,EventArgse){richTextBox1.Text=姓名++学号++语文++数学++英语+\n;}

privatevoidCheckDirectory(){

if(Directory.Exists(System.Windows.Forms.Application.StartupPath+\\data)==false){Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath+\\data);}if(Directory.Exists(System.Windows.Forms.Application.StartupPath+\\data)==false){Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath+\\data);}}

privatevoidbutton3_Click(objectsender,EventArgse){stringrowdata=;

intm=richTextBox1.Lines.Length;string[]lines=newstring[m];for(inti=1;i<m-1;i++)//每一行{lines[i]=richTextBox1.Lines[i]+\n;

string[]cj=lines[i].Split('');

if(cj!=null){rowdata=;for(intj=0;j<cj.Length;j++)//每一列{if(cj[j].ToString()!=){rowdata=rowdata+cj[j].ToString()+,;}

}rowdata.TrimEnd(',');string[]ncj=rowdata.Split(',');

stringstr2=ncj[2].ToString();stringstr3=ncj[3].ToString();stringstr4=ncj[4].ToString().TrimEnd('\n');

//if((int.Parse(str2)+int.Parse(str3)+int.Parse(str4)<180))if((int.Parse(str2)<60||int.Parse(str3)<60||int.Parse(str4)<60)){richTextBox2.AppendText(lines[i]);}}

}

if(File.Exists(System.Windows.Forms.Application.StartupPath+\\data\\3.txt)==true){File.Delete(System.Windows.Forms.Application.StartupPath+\\data\\3.txt);}File.AppendAllText(System.Windows.Forms.Application.StartupPath+\\data\\3.txt,richTextBox1.Text);

if(File.Exists(System.Windows.Forms.Application.StartupPath+\\data\\4.txt)==true){File.Delete(System.Windows.Forms.Application.StartupPath+\\data\\4.txt);}File.AppendAllText(System.Windows.Forms.Application.StartupPath+\\data\\4.txt,richTextBox2.Text);

MessageBox.Show(数据合成OK,在data文件夹);}

}}

免责声明:本站发布的教育资讯(图片、视频和文字)以本站原创、转载和分享为主,文章观点不代表本网站立场。

如果本文侵犯了您的权益,请联系底部站长邮箱进行举报反馈,一经查实,我们将在第一时间处理,感谢您对本站的关注!