1、学 生 实 验 报 告(理工类)课程名称:C#程序设计教程 专业班级: 学生学号: 学生姓名: XFS 所属院部: 软件工程学院 指导教师: 蔡群 20162017 学年 第 2 学期金陵科技学院教务处制实验报告书写要求实验报告原则上要求学生手写,要求书写工整。若因课程特点需打印的,要遵照以下字体、字号、间距等的具体要求。纸张一律采用 A4 的纸张。实验报告书写说明实验报告中一至四项内容为必填项,包括实验目的和要求;实验仪器和设备;实验内容与过程;实验结果与分析。各院部可根据学科特点和实验具体要求增加项目。填写注意事项(1)细致观察,及时、准确、如实记录。(2)准确说明,层次清晰。(3)尽量采
2、用专用术语来说明事物。 (4)外文、符号、公式要准确,应使用统一规定的名词和符号。(5)应独立完成实验报告的书写,严禁抄袭、复印,一经发现,以零分论处。实验报告批改说明实验报告的批改要及时、认真、仔细,一律用红色笔批改。实验报告的批改成绩采用百分制,具体评分标准由各院部自行制定。实验报告装订要求实验批改完毕后,任课老师将每门课程的每个实验项目的实验报告以自然班为单位、按学号升序排列,装订成册,并附上一份该门课程的实验大纲。实验项目名称: 实验一 实验学时: 2 学时 同组学生姓名: XFS 实验地点: A203 实验日期: 2017.3.22 实验成绩: 批改教师: 批改时间: 一、实验目的和
3、要求(1)熟悉使用结构体(2)熟悉使用 DATETIME 类,并清楚它的各种属性和赋值格式(3)熟悉使用枚举类型,并清除它的各种用法(4)了解并使用函数进行封装二、实验仪器和设备具备装载 Microsoft Visual Stdio 2010 或者更高级版本的 Microsoft Visual Stdio 2012/2013,或者 Visual Stdio Ultimate 等的电脑都可以。三、实验过程1.using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Con
4、soleApplication2class Programenum week 星期日,星期一, 星期二, 星期三, 星期四, 星期五, 星期六 ; struct Studentpublic int no;public string name;public DateTime birthday;static void Main(string args)Student s1, s2;s1.no=1;s2.no=2;s1.name = “李明“;s2.name = “王丽“;s1.birthday=new DateTime(1985, 10, 18);s2.birthday=new DateTime(
5、1986, 2, 16);Console.WriteLine(“0的生日为1“, s1.name, s1.birthday.ToShortDateString().ToString(); /ToShortDateString()去除时间Console.WriteLine(“0的生日为1“, s2.name, s2.birthday.ToShortDateString().ToString();Console.WriteLine(“0出生在1“, s1.name, (week)(int)s1.birthday.DayOfWeek);/(week)i转换为对应数字的枚举值Console.Write
6、Line(“0出生在1“, s2.name, (week)(int)s2.birthday.DayOfWeek);Console.WriteLine(“0和1相差2“, s1.name, s2.name, s2.birthday-s1.birthday);Console.ReadLine();2.using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Experiment3class Programstatic void Main(string args)for (i
7、nt i = 100; i noj)namei = namej;namej = tempName;tempName = namei;noi = noj;noj = tempNo;tempNo = noi;Console.Write(“0,-8“, “学号:“);for (int i = 0; i 0) namei = namej;namej = tempName;tempName = namei;noi = noj;noj = tempNo;tempNo = noi;Console.WriteLine(“按姓名排序后:“);Console.Write(“0,-8“, “学号:“);for (i
8、nt i = 0; i 所借图书:“);for (int i = 0; i “);class Programstatic void Main(string args)Reader r1 = new Reader(1234,“王华“ );r1.borrow(new Book(“C语言“,“谭浩强“,100);r1.borrow(new Book(“数据结构“, “韩顺平“, 110);r1.borrow(new Book(“软件工程“, “张远“, 210);Reader r2 = new Reader(2600, “李兵“);r2.borrow(new Book(“操作系统“, “郝兵“, 2
9、08);r1.print();r2.print();Console.Read();四、实验结果与分析分析:本题要有三个类,分别是 Bclass 类、Book 类、Reader 类,其中 Bclass 是基类,其它两个是子类。Reader 类的成员有一个是 book,它对应的是 Book 类数组,用来存放借了的书的,它还有 borrow 方法(借书方法) ,每调用一个就 num+一次,最多借 5 本,还有print()方法,用来输出借书人和所借的书的相关信息。实验项目名称: 实验五 实验学时: 2 学时 同组学生姓名: XFS 实验地点: A203 实验日期: 2017.5.17 实验成绩: 批
10、改教师: 批改时间: 一、实验目的和要求掌握 C#窗体的属性和设计方法,窗体类型和调用方法,各种常见的内部控件的特点、属性、方法和事件过程,多窗体之间传递数据的方法,窗体事件的处理机制。二、实验仪器和设备具备装载 Microsoft Visual Stdio 2010 或者更高级版本的 Microsoft Visual Stdio 2012/2013,或者 Visual Stdio Ultimate 等的电脑都可以。三、实验过程1.using System;using System.Collections.Generic;using System.ComponentModel;using Sy
11、stem.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace EX9_1struct Student public int no;public string name;public string sex;public int classId;public DateTime birthday;public Student (int no,string name,string sex,int classId,DateTime birthday)this.
12、no=no;this.name=name;this.sex=sex;this.classId=classId;this.birthday=birthday;public partial class Form1 : FormStudent s = new Student3;public Form1()s0.no = 1;s0.name = “张三“;s0.sex = “男“;s0.classId = 99091;s0.birthday = new DateTime(1986,3,5);s1.no = 2;s1.name = “李四“;s1.sex = “男“;s1.classId = 99090
13、;s1.birthday = new DateTime(1985,12,1);s2.no = 3;s2.name = “张丽“;s2.sex = “女“;s2.classId = 99091;s2.birthday = new DateTime(1980,3,2);InitializeComponent();private void btnOk_Click(object sender, EventArgs e)if (cmbNo.SelectedIndex = 0) txtNo.Text= s0.no.ToString();txtName.Text = s0.name.ToString();t
14、xtSex.Text = s0.sex.ToString();txtClassId.Text = s0.classId.ToString();txtBirthday.Text = s0.birthday.ToShortDateString();if (cmbNo.SelectedIndex = 1)txtNo.Text = s1.no.ToString();txtName.Text = s1.name.ToString();txtSex.Text = s1.sex.ToString();txtClassId.Text = s1.classId.ToString();txtBirthday.Te
15、xt = s1.birthday.ToShortDateString();if (cmbNo.SelectedIndex = 2)txtNo.Text = s2.no.ToString();txtName.Text = s2.name.ToString();txtSex.Text = s2.sex.ToString();txtClassId.Text = s2.classId.ToString();txtBirthday.Text = s2.birthday.ToShortDateString();四、实验结果与分析1.分析:先完成对前台页面的设计,布置好按钮和下拉列表框等控件,在下拉列表框里
16、添加子集学号,并对部分 textbox 控件设置它们的 enabled 属性为 false。后台先声明一个Student 结构体,成员为学生相关的信息。再声明一个结构体数字,并在 Form1()函数中对其初始化。最后完成确认按钮的点击事件,通过下拉列表框的 slectedindex 属性判断它选择的是哪个学号,然后根据学号将相应的文本框赋值。实验项目名称: 实验六 实验学时: 2 学时 同组学生姓名: XFS 实验地点: A203 实验日期: 2017.5.24 实验成绩: 批改教师: 批改时间: 一、实验目的和要求掌握 C#菜单的基本结构和组成,下拉式菜单和弹出式菜单的设计方法,掌握通用对话
17、框控件的设计方法、掌握 InageList 控件的设计方法;掌握TreeView(树视图)和 ListView(列表视图)控件的设计的方法,掌握ToolStrip(工具栏)和 StatusStrip(状态栏)控件的设计方法。二、实验仪器和设备具备装载 Microsoft Visual Stdio 2010 或者更高级版本的 Microsoft Visual Stdio 2012/2013,或者 Visual Stdio Ultimate 等的电脑都可以。三、实验过程1.using System;using System.Collections.Generic;using System.Comp
18、onentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace EX10_1public partial class Form1 : FormString subItem = new String3 “, “, “ ;String detail = new String3 “, “, “ ;public Form1()InitializeComponent();