




已阅读5页,还剩8页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、创建一个控制台应用程序,要求用事件每 10 秒报告机器的当前时间。 2、编写一个掷筛子 100 次的程序,并打印出各种点数的出现次数。 3、兔子繁殖问题。设有一对新生的兔子,从第三个月开始他们每个月都生一对 兔子,新生的兔子从第三个月开始又每个月生一对兔子。按此规律,并假定兔子 没有死亡,20 个月后共有多少个兔子?要求编写为控制台应用程序。 1. using System; using System.Threading; namespace ConsoleApplication1 class michael public void TimerHandlerA(object obj, EventArgs e)/ Event handler Console.WriteLine(DateTime.Now.ToString(); class Program static void Main() michael m = new michael(); MyTimerClass mc = new MyTimerClass(); mc.Elapsed += m.TimerHandlerA; Thread.Sleep(30000); public class MyTimerClass public event EventHandler Elapsed; private void OnOneSecond(object a, EventArgs i) if (Elapsed != null) Elapsed(a, i); private System.Timers.Timer MyPrivateTimer; public MyTimerClass() MyPrivateTimer = new System.Timers.Timer(); MyPrivateTimer.Elapsed += OnOneSecond; MyPrivateTimer.Interval = 10000; MyPrivateTimer.Enabled = true; 2. using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication2 class Program static void Main(string args) int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0; System.Random rnd = new System.Random(); for (int i = 1; i = 300 | label1.Top = 300) this.label1.Left = 0; this.label1.Top = 0; 运行结果: (4) using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication4 public partial class Form1 : Form private string s = “; private string t = “; int a, b, c; private string r = “; public Form1() InitializeComponent(); private void button1_Click(object sender, EventArgs e) s += button1.Text.ToString(); textBox1.Text = s; private void button2_Click(object sender, EventArgs e) s += button2.Text.ToString(); textBox1.Text = s; private void button3_Click(object sender, EventArgs e) s += button3.Text.ToString(); textBox1.Text = s; private void button4_Click(object sender, EventArgs e) s += button4.Text.ToString(); textBox1.Text = s; private void button5_Click(object sender, EventArgs e) s += button5.Text.ToString(); textBox1.Text = s; private void button6_Click(object sender, EventArgs e) s += button6.Text.ToString(); textBox1.Text = s; private void button7_Click(object sender, EventArgs e) s += button7.Text.ToString(); textBox1.Text = s; private void button8_Click(object sender, EventArgs e) s += button8.Text.ToString(); textBox1.Text = s; private void button9_Click(object sender, EventArgs e) s += button9.Text.ToString(); textBox1.Text = s; private void button15_Click(object sender, EventArgs e) s += button15.Text.ToString(); textBox1.Text = s; private void button14_Click(object sender, EventArgs e) r = button11.Text.ToString(); textBox1.Text = r; b = Convert.ToInt32(s); s = “; if (t = “+“) c = a + b; else if (t = “-“) c = a - b; else if (t = “*“) c = a * b; else if (t = “/“) c = a / b; textBox1.Text = c.ToString(); private void button10_Click(object sender, EventArgs e) t = button10.Text.ToString(); textBox1.Text = t; a = Convert.ToInt32(s); s = “; private void button12_Click(object sender, EventArgs e) t = button12.Text.ToString(); textBox1.Text = t; a = Convert.ToInt32(s); s = “; private void button11_Click(object sender, EventArgs e) t = button11.Text.ToString(); textBox1.Text = t; a = Convert.ToInt32(s); s = “; private void button13_Click(object sender,
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 安全灭火器考试题及答案
- 2025年房地产投资策略报告:城市圈房地产市场分化深度解析
- 2025年工业互联网平台光通信技术升级下的光纤通信网络设备能效优化报告
- 2025至2030年中国钨钼制品市场运行动态及行业投资潜力预测报告
- 2025至2030年中国泛文娱产业市场评估分析及发展前景调研战略研究报告
- 推拿治疗学复习试题附参考答案详解(巩固)
- 有用的企业面试题库及一套参考答案详解
- 2025年度汽车租赁合同租赁车辆租赁期满退租及处理补充协议
- 2025版建筑废弃物再生利用施工合同
- 2025年度物流仓储三方物业租赁管理合同
- 成人脑室外引流护理标准解读
- 算法认识与体验(教学设计)-2024-2025学年人教版(2024)小学信息技术五年级全一册
- 2025年水利工程监理员网络培训考试试题与答案
- 初三化学上教学工作方案
- 微生物实验安全知识培训课件
- 2025危险品押运员模拟考试试题及答案
- 2025年银发族市场洞察报告
- 部队课件的教学设计方法
- 2025年农村个人房屋买卖合同协议书
- 存款定期管理办法
- 2025官方版房屋租赁合同范本下载
评论
0/150
提交评论