c#实验报告.docx
- 文档编号:4056628
- 上传时间:2022-11-27
- 格式:DOCX
- 页数:26
- 大小:223.48KB
c#实验报告.docx
《c#实验报告.docx》由会员分享,可在线阅读,更多相关《c#实验报告.docx(26页珍藏版)》请在冰豆网上搜索。
c#实验报告
学生实验报告
(理工类)
课程名称:
c#程序设计实验专业班级:
M11计算机科学与技术Ⅱ
学生学号:
学生姓名:
所属院部:
龙蟠学院指导教师:
蔡群
2013——2014学年第一学期
金陵科技学院教务处制
实验报告书写要求
实验报告原则上要求学生手写,要求书写工整。
若因课程特点需打印的,要遵照以下字体、字号、间距等的具体要求。
纸张一律采用A4的纸张。
实验报告书写说明
实验报告中一至四项内容为必填项,包括实验目的和要求;实验仪器和设备;实验内容与过程;实验结果与分析。
各院部可根据学科特点和实验具体要求增加项目。
填写注意事项
(1)细致观察,及时、准确、如实记录。
(2)准确说明,层次清晰。
(3)尽量采用专用术语来说明事物。
(4)外文、符号、公式要准确,应使用统一规定的名词和符号。
(5)应独立完成实验报告的书写,严禁抄袭、复印,一经发现,以零分论处。
实验报告批改说明
实验报告的批改要及时、认真、仔细,一律用红色笔批改。
实验报告的批改成绩采用百分制,具体评分标准由各院部自行制定。
实验报告装订要求
实验批改完毕后,任课老师将每门课程的每个实验项目的实验报告以自然班为单位、按学号升序排列,装订成册,并附上一份该门课程的实验大纲。
实验项目名称:
c#应用台控制程序实验学时:
2
同组学生姓名:
实验地点:
A201
实验日期:
2013,10,31实验成绩:
批改教师:
批改时间:
一、实验目的和要求
(1)设计一个简单的C#控制台应用程序,逐行显示自己的学号、姓名、专业等信息;
(2)掌握VisualStudio.NET2010的基本操作方法;
(3)掌握C#应用程序的基本操作过程;
(4)熟悉Windows系统的基本操作;
(5)认真阅读本章相关内容,尤其是案例;
(6)实验前进行程序设计,完成源程序的编写任务;
(7)反复操作直到不需要教程、能熟练操作为止。
二、实验仪器和设备
PC一台、VisualStudio.NET2010
三、实验过程
1.
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;
namespacetest1_1
{
classProgram
{
classStudent
{
intid;
stringname;
stringsubject;
publicStudent()
{
id=31;
name="赵慧";
subject="计算机科学与技术";
}
staticvoidMain(string[]args)
{
Students=newStudent();
System.Console.WriteLine("{0},{1},{2}",s.id,s.name,s.subject);
System.Console.Read();
}
}
}
}
四、实验结果与分析
实验项目名称:
Windows应用程序实验学时:
2
同组学生姓名:
实验地点:
A201
实验日期:
2013,11,7实验成绩:
批改教师:
批改时间:
一、实验目的和要求
(1)设计一个简单的Windows应用程序,在文本框中随意输入一个日期单击“确定”按钮时显示“这一天是星期几”;
(2)掌握VisualStudio.NET2010的基本操作方法;
(3)理解c#的值类型、常量和变量的概念;
(4)掌握C#常用运算符以及表达式的运行规则;
(5)认真阅读本章相关内容,尤其是案例;
(6)实验前进行程序设计,完成源程序的编写任务;
(7)反复操作直到不需要教程、能熟练操作为止。
二、实验仪器和设备
PC一台、VisualStudio.NET2010
三、实验过程
1.
namespaceTest_1
{
publicpartialclassForm1:
Form
{
enumWeekDay{星期天,星期一,星期二,星期三,星期四,星期五,星期六};
publicForm1()
{
InitializeComponent();
}
privatevoidbutton1_Click(objectsender,EventArgse)
{
DateTimedt=Convert.ToDateTime(txtDate.Text);
WeekDaywd=(WeekDay)dt.DayOfWeek;
labResult.Text="这一天是"+wd+".";
}
}
}
四、实验结果与分析
实验项目名称:
Windows应用程序实验学时:
2
同组学生姓名:
实验地点:
A201
实验日期:
2013,11,14实验成绩:
批改教师:
批改时间:
一、实验目的和要求
(1)设计一个简单的Windows应用程序,在文本框中输入学生姓名和考试成绩并保存到结构体数组中,显示最高分和对应的姓名;
(2)掌握VisualStudio.NET2010的基本操作方法;
(3)掌握C#的if,switch分支语句的使用方法;
(4)熟悉Windows系统的基本操作;
(5)认真阅读本章相关内容,尤其是案例;
(6)实验前进行程序设计,完成源程序的编写任务;
(7)反复操作直到不需要教程、能熟练操作为止。
二、实验仪器和设备
PC一台、VisualStudio.NET2010
三、实验过程
1.
namespaceTest3_3
{
publicpartialclassForm1:
Form
{
structContacter
{
publicstringname;
publicintgrade;
}
Contacter[]students=newContacter[10];
inti=0;
publicForm1()
{
InitializeComponent();
}
privatevoidbtnAdd_Click(objectsender,EventArgse)
{
students[i].name=textBox1.Text;
students[i].grade=Convert.ToInt16(textBox2.Text);
i++;
label3.Text="输入成功!
"+"\n";
intmax;
max=students[0].grade;
foreach(Contactercinstudents)
{
if(c.grade>max)max=c.grade;
}
label3.Text+="最高分:
"+Convert.ToString(max)+"";
foreach(Contactercinstudents)
{
if(c.grade==max)
label3.Text+="姓名:
"+c.name;
}
}
}
}
四、实验结果与分析
实验项目名称:
Windows应用程序实验学时:
2
同组学生姓名:
实验地点:
A201
实验日期:
2013,11,21实验成绩:
批改教师:
批改时间:
一、实验目的和要求
(1)设计一个简单的Windows应用程序,显示当前的时间;
(2)掌握VisualStudio.NET2010的基本操作方法;
(3)掌握类的方法成员的声明与调用,理解各种参数在方法中的意义及使用;
(4)熟悉Windows系统的基本操作;
(5)认真阅读本章相关内容,尤其是案例;
(6)实验前进行程序设计,完成源程序的编写任务;
(7)反复操作直到不需要教程、能熟练操作为止。
二、实验仪器和设备
PC一台、VisualStudio.NET2010
三、实验过程
1.
namespaceTest4_2
{
publicpartialclassForm1:
Form
{
publicForm1()
{
InitializeComponent();
}
publicclassTime
{
publicinthour,mintue,second;
publicTime()
{
hour=System.DateTime.Now.Hour;
mintue=System.DateTime.Now.Minute;
second=System.DateTime.Now.Second;
}
publicTime(inth,intm,ints)
{
hour=h;mintue=m;second=s;
}
publicvoidAddSecond()
{
second++;
if(second>=60)
{
second=second%60;
mintue++;
}
if(mintue>=60)
{
mintue=mintue%60;
hour++;
}
}
}
privatevoidbutton1_Click(objectsender,EventArgse)
{
Timet1=newTime();
textBox1.Text=System.DateTime.Now.Hour.ToString();
textBox2.Text=System.DateTime.Now.Minute.ToString();
textBox3.Text=System.DateTime.Now.Second.ToString();
t1.AddSecond();
}
}
}
四、实验结果与分析
实验项目名称:
Windows应用程序实验学时:
2
同组学生姓名:
实验地点:
A201
实验日期:
2013,11,28实验成绩:
批改教师:
批改时间:
一、实验目的和要求
(1)设计一个简单的Windows应用程序,在该程序中首先构造一个学生基本类,再分别构造小学生,中学生,大学生等派生类,当输入相关数据,单击不同的按钮时完成相关的功能;
(2)理解类的继承性与多态性,掌握其应用方法;
(3)熟悉Windows系统的基本操作;
(4)认真阅读本章相关内容,尤其是案例;
(5)实验前进行程序设计,完成源程序的编写任务;
(6)反复操作直到不需要教程、能熟练操作为止。
二、实验仪器和设备
PC一台、VisualStudio.NET2010
三、实验过程
1.
namespaceTest5_1
{
publicabstractclassStudent
{
protectedstringname;
protectedintage;
publicstaticintnumber;
publicStudent(stringname,intage)
{
this.name=name;
this.age=age;
number++;
}
publicstringName{get{returnname;}}
publicabstractdoubleAverage();
}
publicclassPupil:
Student
{
protecteddoublechinese;
protecteddoublemath;
publicPupil(stringname,intage,doublechinese,doublemath):
base(name,age)
{
this.chinese=chinese;
this.math=math;
}
publicoverridedoubleAverage()
{
return(chinese+math)/2;
}
}
publicclassJenior:
Student
{
protecteddoublechinese;
protecteddoublemath;
protecteddoubleenglish;
publicJenior(stringname,intage,doublechinese,doublemath,doubleenglish)
:
base(name,age)
{
this.chinese=chinese;
this.math=math;
this.english=english;
}
publicoverridedoubleAverage()
{
return(chinese+math+english)/3;
}
}
publicclassSenior:
Student
{
protecteddoublexuanxiu;
protecteddoublebixiu;
publicSenior(stringname,intage,doublexuanxiu,doublebixiu)
:
base(name,age)
{
this.xuanxiu=xuanxiu;
this.bixiu=bixiu;
}
publicoverridedoubleAverage()
{
return(xuanxiu+bixiu)/2;
}
}
}
namespaceTest5_1
{
publicpartialclassForm1:
Form
{
publicForm1()
{
InitializeComponent();
}
privatevoidbutton1_Click(objectsender,EventArgse)
{
stringa=Convert.ToString(textBox1.Text);
intb=Convert.ToInt32(textBox2.Text);
doublec=Convert.ToInt32(textBox3.Text);
doubled=Convert.ToInt32(textBox4.Text);
Pupilp=newPupil(a,b,c,d);
label6.Text="总人数:
"+Student.number+",姓名:
"+p.Name+",小学生,平均成绩为:
"+p.Average();
}
privatevoidbutton2_Click(objectsender,EventArgse)
{
stringa=Convert.ToString(textBox1.Text);
intb=Convert.ToInt32(textBox2.Text);
doublec=Convert.ToInt32(textBox3.Text);
doubled=Convert.ToInt32(textBox4.Text);
doubler=Convert.ToInt32(textBox5.Text);
Jeniorj=newJenior(a,b,c,d,r);
label6.Text="总人数:
"+Student.number+",姓名:
"+j.Name+",中学生,平均成绩为:
"+j.Average();
}
privatevoidbutton3_Click(objectsender,EventArgse)
{
stringa=Convert.ToString(textBox1.Text);
intb=Convert.ToInt32(textBox2.Text);
doublec=Convert.ToInt32(textBox3.Text);
doubled=Convert.ToInt32(textBox4.Text);
Seniors=newSenior(a,b,c,d);
label6.Text="总人数:
"+Student.number+",姓名:
"+s.Name+",大学生,平均成绩为:
"+s.Average();
}
}
}
四、实验结果与分析
实验项目名称:
Windows应用程序实验学时:
2
同组学生姓名:
实验地点:
A201
实验日期:
2013,12,5实验成绩:
批改教师:
批改时间:
一、实验目的和要求
(1)设计一个简单的Windows应用程序,定义一个Teacher类,并用ArrayList实现与实例6-2相似的功能;
(2)掌握VisualStudio.NET2010的基本操作方法;
(3)初步掌握索引器的定义与使用;
(4)熟悉Windows系统的基本操作;
(5)认真阅读本章相关内容,尤其是案例;
(6)实验前进行程序设计,完成源程序的编写任务;
(7)反复操作直到不需要教程、能熟练操作为止。
二、实验仪器和设备
PC一台、VisualStudio.NET2010
三、实验过程
1.
namespaceTest6
{
publicpartialclassForm1:
Form
{
ArrayListALTeachers=newArrayList();
privatevoidForeach()
{
foreach(objecttinALTeachers)
{
TeachertForeach=(Teacher)t;
lblShow.Text+="\n"+tForeach.showmsg();
}
}
publicForm1()
{
InitializeComponent();
}
privatevoidbtnAdd_Click(objectsender,EventArgse)
{
stringn=Convert.ToString(textBox1.Text);
stringc=Convert.ToString(textBox2.Text);
Teachert1=newTeacher(n,c);
ALTeachers.Add(t1);
lblShow.Text="";
Foreach();
}
privatevoidbtnDele_Click(objectsender,EventArgse)
{
intkey=Convert.ToInt32(textBox3.Text);
ALTeachers.RemoveAt(key);
lblShow.Text="";
Foreach();
}
}
}
namespaceTest6
{
classTeacher
{
stringname;
stringzhicheng;
publicTeacher(stringname,stringzhicheng)
{
this.name=name;
this.zhicheng=zhicheng;
}
publicstringshowmsg()
{
returnstring.Format("姓名:
{0},职称:
{1}",name,zhicheng);
}
}
}
四、实验结果与分析
实验项目名称:
Windows应用程序实验学时:
2
同组学生姓名:
实验地点:
A201
实验日期:
2013,12.12实验成绩:
批改教师:
批改时间:
一、实验目的和要求
(1)设计一个简单的Windows应用程序,随机生成0~100之间的10个数字,并通过委托实现升序或降序排列;
(2)掌握委托的声明,实例化与使用;
(3)掌握事件的概念,理解事件处理的机制;
(4)熟悉Windows系统的基本操作;
(5)认真阅读本章相关内容,尤其是案例;
(6)实验前进行程序设计,完成源程序的编写任务;
(7)反复操作直到不需要教程、能熟练操作为止。
二、实验仪器和设备
PC一台、VisualStudio.NET2010
三、实验过程
namespaceTest8_1
{
delegateboolCompare(intx,inty);
publicpartialclassForm1:
Form
{
int[]a=newint[10];
voidSortArray(Comparecompare)
{
for(inti=0;i for(intj=0;j<=i;j++) if(compare(a[i],a[j])) { intt=a[i]; a[i]=a[j]; a[j]=t; } } boolAscending(intx,inty) { returnx } boolDesecding(intx,inty) { returnx>y; } voiddisplay() { txtTarget.Text=""; foreach(intiina) { txtTarget.Text+=i+"\r\n"; } } publicForm1() { InitializeComponent(); } privatevoidbtnCreateArray_Click(objectsender,EventArgse) { txtSource.Text=""; txtTarget.Text=""; Randomr=newRandom(); for(inti=0;i { a[i]=r.Next(100); txtSource.Text+=a[i]+"\r\n";
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- c# 实验 报告
![提示](https://static.bdocx.com/images/bang_tan.gif)