




已阅读5页,还剩11页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
实验报告一姓 名专业课程名称一、 实验名称:实验1二、 实验目的:掌握使用命令行开发简单的C#应用程序掌握使用Visual Studio编写控制台应用程序掌握Visual Studio环境下程序的跟踪调试了解Visual Studio在线帮助的使用掌握应用程序命令行参数的使用三、实验内容及要求利用ADO.NET完成数据的增、删、改、查1.1 鼠标、窗口、菜单的操作1.2 用户账户的管理1.3 桌面图标的排列、设置桌面背景和屏幕保护程序1.4 设置任务栏、语言栏1.5 选择输入法、在“记事本”文件中输入各种符号2.1了解“资源管理器的使用”2.2 设置文件夹选项、查找文件或文件夹2.3 文件/文件夹操作2.4 使用回收站具体要求请见大学计算机应用基础学习指导P37P48四、实验材料、工具、或软件Windows XP Professional SP3Visual Studio 2005五、实验步骤、结果(或记录)5-15-25-35-45-55-65-7课后题:1.2.六、实验过程中存在问题和解决 有个别程序函数间的衔接不是很明白!七、意见和建议八、教师评语(或成绩) 教师签字: 年 月 日备注:实验报告的命名格式为:学号-姓名-实验序号。如805052103-刘闽-实验一1.using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Console_5_1 class MyMath public const double PI = 3.1415926; public static double Perimeter(double r) double p = 2 * PI * r; return p ; public static double Area(double r) double a = PI * r * r; return a; public static double Volume(double r) double v = 4 * PI * Math.Pow(r, 3) / 3; return v; class Program static void Main(string args) Console.Write(请输入半径:); double r = double.Parse(Console.ReadLine(); Console.WriteLine(圆的周长=0, MyMath.Perimeter(r); Console.WriteLine(圆的面积=0, MyMath.Area(r); Console.WriteLine(球的体积=0, MyMath.Volume(r); Console.ReadKey(); 2.using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication4 public class TemperatureCelsius protected double degree; public TemperatureCelsius(double d) this.degree = d; public double ToFahrenheit() return (degree * 9 / 5) + 32; class Program static void Main(string args) Console.Write(请输入摄氏温度:); double d = Double.Parse(Console.ReadLine(); TemperatureCelsius celsius = new TemperatureCelsius(d); Console.WriteLine(摄氏温度 = 0,华氏温度 = 1 , d, celsius.ToFahrenheit(); Console.ReadKey(); 3.using System;using System.Collections.Generic;using System.Text;namespace Console5_3 public class Person public string name; public uint age; public Person(string name, uint age) = name; this.age = age; public virtual void Getinfo() Console.WriteLine(Name:0, name); Console.WriteLine(Age:0,age); public class Teacher : Person public string teacherID; public Teacher(string name, uint age, string id) : base(name, age) this.teacherID = id; public override void Getinfo() base.Getinfo(); Console.WriteLine(teacherID:0, teacherID); public class TestPersonTeacher static void Main(string args) Teacher objteacher = new Teacher(MR. YU, 40, 1990108001); objteacher.Getinfo(); Console.ReadLine(); 4.using System;using System.Collections.Generic;using System.Text;namespace _4 public abstract class Shape protected string name; public Shape(string name) = name; public abstract void show(); public abstract double area(); public class rectangle : Shape protected double weight; protected double heigh; public rectangle(string name, double w, double h):base(name ) this.weight = w; this.heigh = h; public override void show() Console.WriteLine(rectangle:0,area:1, name, weight * heigh); public override double area() return weight * heigh; public class circle : Shape protected double radius; public circle(string name, double r) : base(name) this.radius = r; public override void show() Console .WriteLine (circle:0,area1,name ,Math .PI *radius*radius ); public override double area() return Math.PI * radius * radius; class Program static void Main(string args) Shape s=new rectangle (小矩形,2.0,4.0),new circle (大圆,10); foreach (Shape e in s) e.show(); Console.ReadKey(); 5.using System;using System.Collections.Generic;using System.Text;namespace _5 class Program public struct Complex public int real; public int imaginary; public Complex(int real, int imaginary) this.real = real; this.imaginary = imaginary; public static Complex operator +(Complex c1, Complex c2) return new Complex(c1.real + c2.real, c1.imaginary + c2.imaginary); public static Complex operator -(Complex c1, Complex c2) return new Complex(c1.real - c2.real, c1.imaginary - c2.imaginary); public static Complex operator *(Complex c1, Complex c2) return new Complex(c1.real * c2.real - c1.imaginary * c2.imaginary, c1.real * c2.real + c1.imaginary * c2.imaginary); public override string ToString() return (string.Format(0+1i, real, imaginary); class testComplex static void Main(string args) Complex num1=new Complex (5,7); Complex num2=new Complex (1,2); Complex sum=num1 +num2 ; Complex sub=num1 -num2 ; Complex mul=num2 *num1 ; Console .WriteLine (第一个复数是:0,num1 ); Console .WriteLine (第二个复数是:0,num2 ); Console .WriteLine (两个复数之和:0,sum ); Console .WriteLine (两个复数之差:0,sub ); Console .WriteLine (两个复数之积:0,mul ); Console.ReadKey(); 6.namespace sy_5_6 public interface ICDPlayer void Play(); void Stop(); void PreviousTrack(); void NextTrack(); int CurrentTrack get; public class CDPlayer : ICDPlayer private int currentTrack = 0; public void Play() Console.WriteLine(启动CD.); public void Stop() Console.WriteLine(停止CD.); public void PreviousTrack() Console.WriteLine(前一个音轨.); if (currentTrack = 1) currentTrack-; public void NextTrack() Console.WriteLine(后一个音轨.); currentTrack+; public int CurrentTrack get return currentTrack; class TestCDPlayer static void Main(string args) CDPlayer myCD = new CDPlayer(); myCD.Play(); Console.WriteLine(myCD.CurrentTrack=0, myCD.CurrentTrack); myCD.NextTrack(); myCD.NextTrack(); Console.WriteLine(myCD.CurrentTrack=0, myCD.CurrentTrack); ICDPlayer myICD = (ICDPlayer)myCD; myICD.PreviousTrack(); Console.WriteLine(myICD.CurrentTrack=0, myICD.CurrentTrack); myICD.Stop(); Console.ReadKey(); 7.using System;using System.Collections;using System.Linq;using System.Text;namespace _5_7 class Program public class NameListEventArgs : EventArgs public string Name get; set; public int Count get; set; public NameListEventArgs(string name, int count) Name = name; Count = count; public delegate void NameListEventHandler(object source, NameListEventArgs args); public class NameList ArrayList list; public event NameListEventHandler nameListEvent; public NameList() list = new ArrayList(); public void Add(string Name) list.Add(Name); if (nameListEvent != null) nameListEvent(this, new NameListEventArgs(Name, list.Count); public class EventDemo public static void Method1(object source, NameListEventArgs args) Console.WriteLine(列表中增加了项目:0, args.Name); public static void Method2(object source, NameListEventArgs args) Console.WriteLine(列表中的项目数:0, args.Count); static void Main(string args) NameList n1 = new NameList(); ListEvent += new NameListEventHandler(EventDemo.Method1); ListEvent += new NameListEventHandler(EventDemo.Method2); n1.Add(张三); n1.Add(李四); n1.Add(王五); Console.ReadLine(); 课后题1.using System;namespace _5 class Program public abstract class sharp protected string name; public sharp(string name) = name; public abstract void area(); public abstract void perimeter(); public class circle : sharp public double radius; public circle(string name, double r) : base(name) this.radius = r; public override void area() Console.WriteLine(circle:0,area:1, name, Math.PI * radius * radius); public override void perimeter() Console.WriteLine(circle:0,perimeter:1, name, 2 * Math.PI * radius); public class triangle : sharp public double side1, side2, side3,p,h; public triangle(string name, double a, double b,double c) : base(name) this.side1 = a; this.side2 = b; this.side3 = c; public override void area() p=side1+side2+side3; h=p/2; Console.WriteLine(triangle:0,area:1, name, Math.Sqrt(h * (h - side1)*(h - side2)*(h - side3); public override void perimeter() Console.WriteLine(triangle:0,perimeter:1, name, side1 + side2 + side3); public class quadrangle : sharp public double weight; public double height; public quadrangle(string name, double w, double h) : base(name) this.weight = w; this.height = h; public override void area() Console.WriteLine(quadrangle:0,a
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- GB/T 29124-2025燃料电池电动汽车配套设施规范
- 2024年咨询工程师真题及参考答案详解(培优A卷)
- 2024-2025学年度注册公用设备工程师预测复习含答案详解(培优B卷)
- 2024年土木工程建筑施工考前冲刺练习题附参考答案详解【综合题】
- 2025年苏州工业职业技术学院单招《物理》考试彩蛋押题附参考答案详解(综合卷)
- 2024-2025学年中医助理医师自我提分评估及答案详解【全优】
- 传染病患者排泄护理与感染防控要点
- 2023年度高升专通关考试题库【名校卷】附答案详解
- 2025年城市公共自行车智能化改造项目的智能化管理方案报告
- 中班科学领域教案《奇妙的磁铁》反思
- 成品油市场管理办法培训
- 2025至2030中国管理咨询行业产业运行态势及投资规划深度研究报告
- 【课件】绝对值(课件)数学人教版2024七年级上册
- 适当性管理讲课件
- 上海爱尔眼科医院营销策略:基于市场细分与竞争优势的深入探究
- 苏教版三年级上册综合实践活动教案
- 2025-2030中国拟薄水铝石市场投资效益与未来供需形势分析报告
- 2025年中国盐业集团有限公司所属企业招聘笔试冲刺题(带答案解析)
- 2024年四川省委网信办遴选公务员真题
- 天车设备安全管理制度
- 活动承办方协议书
评论
0/150
提交评论