亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? form1.cs

?? C#寫的模擬磁盤磁頭調度程序 包含fcfs sstf elevator3種算法
?? CS
字號:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Diskatt
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.TextBox InBox;
		private System.ComponentModel.IContainer components;
		string input;
		string [] process;
		char a='\n';
		private System.Windows.Forms.Button BtRead;
		private System.Windows.Forms.Label label1;
		public System.Windows.Forms.Label ReadedBox;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.RadioButton radioButton1;
		private System.Windows.Forms.RadioButton radioButton2;
		private System.Windows.Forms.RadioButton radioButton3;
		int [] track;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.TextBox BeginBox;
		private System.Windows.Forms.Label BeginTrack;
		private System.Windows.Forms.Button Btreset;
		private System.Windows.Forms.Button BtRun;
		int begin=0;
		int algocase=0;
		private System.Windows.Forms.Label ResultBox;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Panel PnDraw;
		private System.Windows.Forms.Button BtSim;
		private System.Windows.Forms.Button BtReSim;
		int [] result;
		int x=210;
		int simnum=0;

		public Form1()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.InBox = new System.Windows.Forms.TextBox();
			this.BtRead = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			this.ReadedBox = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.radioButton3 = new System.Windows.Forms.RadioButton();
			this.radioButton2 = new System.Windows.Forms.RadioButton();
			this.radioButton1 = new System.Windows.Forms.RadioButton();
			this.BeginBox = new System.Windows.Forms.TextBox();
			this.button1 = new System.Windows.Forms.Button();
			this.BeginTrack = new System.Windows.Forms.Label();
			this.Btreset = new System.Windows.Forms.Button();
			this.BtRun = new System.Windows.Forms.Button();
			this.ResultBox = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.PnDraw = new System.Windows.Forms.Panel();
			this.BtSim = new System.Windows.Forms.Button();
			this.BtReSim = new System.Windows.Forms.Button();
			this.groupBox1.SuspendLayout();
			this.SuspendLayout();
			// 
			// InBox
			// 
			this.InBox.AcceptsReturn = true;
			this.InBox.AcceptsTab = true;
			this.InBox.AutoSize = false;
			this.InBox.Location = new System.Drawing.Point(440, 32);
			this.InBox.Multiline = true;
			this.InBox.Name = "InBox";
			this.InBox.Size = new System.Drawing.Size(152, 224);
			this.InBox.TabIndex = 0;
			this.InBox.Text = "";
			// 
			// BtRead
			// 
			this.BtRead.Location = new System.Drawing.Point(448, 272);
			this.BtRead.Name = "BtRead";
			this.BtRead.Size = new System.Drawing.Size(136, 32);
			this.BtRead.TabIndex = 1;
			this.BtRead.Text = "Read";
			this.BtRead.Click += new System.EventHandler(this.BtRead_Click);
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(440, 8);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(112, 24);
			this.label1.TabIndex = 2;
			this.label1.Text = "Input HD Serial";
			// 
			// ReadedBox
			// 
			this.ReadedBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.ReadedBox.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.ReadedBox.Location = new System.Drawing.Point(280, 32);
			this.ReadedBox.Name = "ReadedBox";
			this.ReadedBox.Size = new System.Drawing.Size(152, 224);
			this.ReadedBox.TabIndex = 3;
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(272, 8);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(128, 24);
			this.label2.TabIndex = 4;
			this.label2.Text = "Readed Serial";
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.radioButton3);
			this.groupBox1.Controls.Add(this.radioButton2);
			this.groupBox1.Controls.Add(this.radioButton1);
			this.groupBox1.Location = new System.Drawing.Point(88, 24);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(168, 128);
			this.groupBox1.TabIndex = 5;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "Algorithms";
			// 
			// radioButton3
			// 
			this.radioButton3.Location = new System.Drawing.Point(16, 96);
			this.radioButton3.Name = "radioButton3";
			this.radioButton3.Size = new System.Drawing.Size(120, 24);
			this.radioButton3.TabIndex = 2;
			this.radioButton3.Text = "Elevator";
			this.radioButton3.CheckedChanged += new System.EventHandler(this.radioButton3_CheckedChanged);
			// 
			// radioButton2
			// 
			this.radioButton2.Location = new System.Drawing.Point(16, 56);
			this.radioButton2.Name = "radioButton2";
			this.radioButton2.Size = new System.Drawing.Size(128, 24);
			this.radioButton2.TabIndex = 1;
			this.radioButton2.Text = "SSTF";
			this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
			// 
			// radioButton1
			// 
			this.radioButton1.Location = new System.Drawing.Point(16, 16);
			this.radioButton1.Name = "radioButton1";
			this.radioButton1.Size = new System.Drawing.Size(120, 24);
			this.radioButton1.TabIndex = 0;
			this.radioButton1.Text = "FCFS";
			this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
			// 
			// BeginBox
			// 
			this.BeginBox.Location = new System.Drawing.Point(16, 192);
			this.BeginBox.Name = "BeginBox";
			this.BeginBox.Size = new System.Drawing.Size(72, 20);
			this.BeginBox.TabIndex = 6;
			this.BeginBox.Text = "0";
			this.BeginBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(96, 184);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(80, 32);
			this.button1.TabIndex = 7;
			this.button1.Text = "Set as Begin Track";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// BeginTrack
			// 
			this.BeginTrack.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.BeginTrack.Location = new System.Drawing.Point(184, 192);
			this.BeginTrack.Name = "BeginTrack";
			this.BeginTrack.Size = new System.Drawing.Size(88, 16);
			this.BeginTrack.TabIndex = 8;
			this.BeginTrack.Text = "0";
			// 
			// Btreset
			// 
			this.Btreset.Location = new System.Drawing.Point(48, 240);
			this.Btreset.Name = "Btreset";
			this.Btreset.Size = new System.Drawing.Size(192, 32);
			this.Btreset.TabIndex = 9;
			this.Btreset.Text = "Reset";
			this.Btreset.Click += new System.EventHandler(this.Btreset_Click);
			// 
			// BtRun
			// 
			this.BtRun.Location = new System.Drawing.Point(288, 272);
			this.BtRun.Name = "BtRun";
			this.BtRun.Size = new System.Drawing.Size(136, 32);
			this.BtRun.TabIndex = 10;
			this.BtRun.Text = "Run";
			this.BtRun.Click += new System.EventHandler(this.BtRun_Click);
			// 
			// ResultBox
			// 
			this.ResultBox.Location = new System.Drawing.Point(8, 320);
			this.ResultBox.Name = "ResultBox";
			this.ResultBox.Size = new System.Drawing.Size(648, 24);
			this.ResultBox.TabIndex = 11;
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(8, 296);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(112, 16);
			this.label3.TabIndex = 12;
			this.label3.Text = "Produced Serial";
			// 
			// PnDraw
			// 
			this.PnDraw.Location = new System.Drawing.Point(8, 352);
			this.PnDraw.Name = "PnDraw";
			this.PnDraw.Size = new System.Drawing.Size(512, 240);
			this.PnDraw.TabIndex = 13;
			this.PnDraw.Paint += new System.Windows.Forms.PaintEventHandler(this.PnDraw_Paint);
			// 
			// BtSim
			// 
			this.BtSim.Location = new System.Drawing.Point(544, 360);
			this.BtSim.Name = "BtSim";
			this.BtSim.Size = new System.Drawing.Size(96, 32);
			this.BtSim.TabIndex = 14;
			this.BtSim.Text = "Simulate";
			this.BtSim.Click += new System.EventHandler(this.BtSim_Click);
			// 
			// BtReSim
			// 
			this.BtReSim.Location = new System.Drawing.Point(544, 424);
			this.BtReSim.Name = "BtReSim";
			this.BtReSim.Size = new System.Drawing.Size(96, 32);
			this.BtReSim.TabIndex = 15;
			this.BtReSim.Text = "Reset Simulate";
			this.BtReSim.Click += new System.EventHandler(this.BtReSim_Click);
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(664, 606);
			this.Controls.Add(this.BtReSim);
			this.Controls.Add(this.BtSim);
			this.Controls.Add(this.PnDraw);
			this.Controls.Add(this.label3);
			this.Controls.Add(this.ResultBox);
			this.Controls.Add(this.BtRun);
			this.Controls.Add(this.Btreset);
			this.Controls.Add(this.BeginTrack);
			this.Controls.Add(this.button1);
			this.Controls.Add(this.BeginBox);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.ReadedBox);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.BtRead);
			this.Controls.Add(this.InBox);
			this.MaximizeBox = false;
			this.Name = "Form1";
			this.Text = "Disk Attemper";
			this.groupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		private void BtRead_Click(object sender, System.EventArgs e)
		{
			int i;
			input=InBox.Text;
			if (input=="")
				return;
			process=input.Split(a);
			track=new int[process.Length];
			for (i=0;i<process.Length;i++)
				track[i]=Convert.ToInt32(process[i]);
			ReadedBox.Text=InBox.Text;
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			begin=Convert.ToInt32(BeginBox.Text);
			BeginTrack.Text=BeginBox.Text;
			x=begin;
			PnDraw.Invalidate();
		}

		private void Btreset_Click(object sender, System.EventArgs e)
		{
			BeginTrack.Text="0";
			BeginBox.Text="0";
			ReadedBox.Text="";
			InBox.Text="";
			ResultBox.Text="";
			begin=0;
			x=210;
			simnum=0;
			track=null;
			result=null;
		}

		private void radioButton1_CheckedChanged(object sender, System.EventArgs e)
		{
			algocase=1;
		}

		private void radioButton2_CheckedChanged(object sender, System.EventArgs e)
		{
			algocase=2;
		}

		private void radioButton3_CheckedChanged(object sender, System.EventArgs e)
		{
			algocase=3;
		}

		private void BtRun_Click(object sender, System.EventArgs e)
		{
			simnum=0;
			switch(algocase)
			{
				case 1:
					if(FCFS(track,ref result))
						   fill();
					break;
				case 2:
					if(SSTF(track,ref result,begin))
						fill();
					break;
				case 3:
					if(Elevator(track,ref result,begin))
						fill();
					break;
			}
		}
		
		private bool FCFS(int [] x,ref int [] y)
		{
			int i=0;
			if (x==null)
				return false;
			y=new int[x.Length];
			for (i=0;i<x.Length;i++)
			{
				y[i]=x[i];
			}
			return true;
		}

		private bool SSTF(int [] u,ref int [] y,int z)
		{
			int position=0;
			int i=0,j=0;
			int now,distance;
			if (u==null)
				return false;
			int [] x= new int [u.Length];
			for (i=0;i<u.Length;i++)
				x[i]=u[i];
			y=new int[x.Length];
			now=z;
			for (i=0;i<x.Length;i++)
			{
				distance=999;
				for(j=0;j<x.Length;j++)
				{
					if(x[j]!=0)
					{
						if (distance>Math.Abs(x[j]-now))
						{
							distance=Math.Abs(x[j]-now);
							position=j;
						}
					}
				}
				y[i]=x[position];
				now=x[position];
				x[position]=0;
			}
			x=null;
			return true;
		}
		
		private bool Elevator(int [] u,ref int [] y,int z)
		{
			int i=0,j=0,k=0;
			int now;
			int [] inner,outter;
			if (u==null)
				return false;
			int [] x= new int [u.Length];
			for (i=0;i<u.Length;i++)
				x[i]=u[i];
			y=new int[x.Length];
			now=z;
			for (i=0,j=0;i<x.Length;i++)
			{
				if (x[i]<=z)
					j++;
			}
			inner=new int[j];
			outter=new int[x.Length-j];
			for (i=0,j=0,k=0;i<x.Length;i++)
			{
				if (x[i]<=z)
				{
					inner[j]=x[i];
					j++;
				}
				if (x[i]>z)
				{
					outter[k]=x[i];
					k++;
				}
			}
			Array.Sort(inner);
			Array.Reverse(inner);
			Array.Sort(outter);
			if (inner.Length==x.Length)
			{
				for (i=0;i<x.Length;i++)
				{
					y[i]=inner[i];
				}
				return true;
			}
			if (outter.Length==x.Length)
			{
				for (i=0;i<x.Length;i++)
				{
					y[i]=outter[i];
				}
				return true;
			}
			if ((x[0]-z)<0)
			{
				for(i=0;i<inner.Length;i++)
				{
					y[i]=inner[i];
				}
				for(i=0;i<outter.Length;i++)
				{
					y[inner.Length+i]=outter[i];
				}
				return true;
			}
			if ((x[0]-z)>0)
			{
				for(i=0;i<outter.Length;i++)
				{
					y[i]=outter[i];
				}
				for(i=0;i<inner.Length;i++)
				{
					y[outter.Length+i]=inner[i];
				}
				return true;
			}
			return false;
		}

		private void fill()
		{
			ResultBox.Text="";
			ResultBox.Text+=Convert.ToString(begin);
			for (int i=0;i<result.Length;i++)
			{
				ResultBox.Text+="->";
				ResultBox.Text+=Convert.ToString(result[i]);
			}
		}

		private void PnDraw_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
		{
			Graphics g=e.Graphics;
			Pen pen= new Pen(Color.DarkBlue);
			for(int i=0;i<10;i++)
			{
				g.DrawEllipse(pen,0+i*20,20+i*10,400-i*40,200-i*20);
			}
			g.DrawLine(pen,200+x,100,200+x,120);
			g.DrawLine(pen,200+x,100,400,0);
		}

		private void BtSim_Click(object sender, System.EventArgs e)
		{
			if (simnum<result.Length)
			{
				x=result[simnum];
				simnum++;
			}
			PnDraw.Invalidate();
		}

		private void BtReSim_Click(object sender, System.EventArgs e)
		{
			simnum=0;
			x=begin;
			PnDraw.Invalidate();
		}
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩一级片在线观看| 亚洲制服丝袜av| 日韩精品高清不卡| 日本韩国一区二区三区视频| 久久久一区二区| 九色porny丨国产精品| 日韩精品一区二区三区在线播放| 日本不卡视频一二三区| 91精品免费观看| 美腿丝袜亚洲色图| 精品国产91乱码一区二区三区| 日韩 欧美一区二区三区| 欧美男生操女生| 日韩不卡免费视频| 日韩美女视频在线| 精品一区在线看| 久久亚洲综合av| 国产精品66部| 亚洲天堂中文字幕| 欧美日韩一级片网站| 日韩黄色片在线观看| 精品少妇一区二区三区日产乱码 | 日本高清不卡aⅴ免费网站| 自拍偷自拍亚洲精品播放| 色成年激情久久综合| 亚洲一二三四区不卡| 欧美一区午夜精品| 九九国产精品视频| 国产精品系列在线| 欧美性色综合网| 久久国产精品区| 国产精品网站导航| 欧美三级在线看| 国产在线视频不卡二| 国产精品久久二区二区| 欧美日韩中字一区| 国产美女在线观看一区| 亚洲欧美激情视频在线观看一区二区三区 | 久久久久青草大香线综合精品| 成人黄色片在线观看| 亚洲综合激情另类小说区| 日韩三级免费观看| 99精品久久只有精品| 青青国产91久久久久久| 中文字幕av一区二区三区高 | 久久av中文字幕片| 亚洲欧美aⅴ...| 日韩欧美你懂的| 一本高清dvd不卡在线观看| 久久er精品视频| 亚洲伊人色欲综合网| 久久九九99视频| 欧美美女黄视频| 99精品在线观看视频| 精品一区在线看| 亚洲一二三区在线观看| 日本一区二区三区久久久久久久久不| 在线观看91精品国产入口| 精品在线你懂的| 亚洲国产美女搞黄色| 久久蜜桃一区二区| 欧美一区午夜精品| 在线一区二区三区做爰视频网站| 国产综合久久久久久久久久久久| 亚洲高清不卡在线| 亚洲三级小视频| 国产欧美日韩在线观看| 欧美mv和日韩mv国产网站| 欧美日韩电影一区| 在线观看一区日韩| 不卡的av网站| 国产精品一色哟哟哟| 九九国产精品视频| 日韩在线播放一区二区| 亚洲一区在线视频| 亚洲人成影院在线观看| 国产精品久久久久一区| 久久久高清一区二区三区| 欧美电影免费观看高清完整版在线观看| 日本精品视频一区二区| 91视视频在线直接观看在线看网页在线看| 国产主播一区二区三区| 久久国产人妖系列| 久久精品国产澳门| 麻豆视频一区二区| 美女久久久精品| 日本成人在线网站| 免费美女久久99| 日本午夜精品一区二区三区电影| 亚洲国产中文字幕在线视频综合 | 日韩免费一区二区三区在线播放| 欧美午夜理伦三级在线观看| 色美美综合视频| 色噜噜狠狠一区二区三区果冻| 99精品视频在线免费观看| 91丨porny丨中文| 99久久精品久久久久久清纯| 成a人片亚洲日本久久| 成人美女视频在线看| 国产91精品免费| 播五月开心婷婷综合| 91在线视频网址| 欧洲一区二区三区在线| 欧美日韩一区在线| 日韩亚洲欧美在线观看| 久久综合色一综合色88| 欧美国产1区2区| 国产精品久久久久桃色tv| 亚洲欧美一区二区三区孕妇| 亚洲一区二区三区在线播放| 日韩精品一二三区| 国产精品自产自拍| 99re6这里只有精品视频在线观看| 一本到三区不卡视频| 欧美日本国产一区| 26uuu国产在线精品一区二区| 久久夜色精品国产欧美乱极品| 国产精品久久久久婷婷| 亚洲高清不卡在线| 韩国中文字幕2020精品| 不卡av在线网| 欧美理论电影在线| 久久婷婷成人综合色| 亚洲视频免费看| 日韩和欧美一区二区| 国产成人aaaa| 欧美视频在线一区| 久久久91精品国产一区二区精品| 亚洲欧美国产三级| 麻豆成人久久精品二区三区红| 国产99一区视频免费| 欧美日韩一区二区欧美激情 | 一本大道av伊人久久综合| 欧美喷潮久久久xxxxx| 国产目拍亚洲精品99久久精品| 亚洲主播在线播放| 处破女av一区二区| 欧美一区二区视频在线观看2020| 欧美国产欧美综合| 日韩av在线发布| 色综合久久久久久久久| 精品久久久久久亚洲综合网| 亚洲久草在线视频| 国产一区二区三区四| 欧美日韩精品一区视频| 国产精品久久久久精k8| 久久精品国产亚洲一区二区三区| 91婷婷韩国欧美一区二区| 欧美变态tickle挠乳网站| 一区二区三区高清| 丰满岳乱妇一区二区三区| 欧美一区二区福利在线| 一区二区三区鲁丝不卡| 国产99精品在线观看| 精品理论电影在线观看 | 久久精品免费在线观看| 日韩高清电影一区| 91国偷自产一区二区开放时间 | 日本在线不卡视频| 色婷婷激情综合| 国产精品麻豆久久久| 狠狠色2019综合网| 欧美一区二区三区在线观看| 一区二区三区精品在线观看| 北条麻妃国产九九精品视频| 欧美精品一区二区三区蜜桃| 日韩av不卡在线观看| 欧美日韩一区精品| 亚洲综合丁香婷婷六月香| 99久久精品国产导航| 国产午夜精品在线观看| 国内外精品视频| 欧美va日韩va| 久久91精品国产91久久小草| 欧美高清性hdvideosex| 亚洲福中文字幕伊人影院| 欧洲一区在线观看| 亚洲自拍都市欧美小说| 在线观看日韩电影| 亚洲一区欧美一区| 欧美三片在线视频观看 | 一区二区三区中文字幕| 一本大道av一区二区在线播放| 亚洲视频免费观看| 色呦呦网站一区| 一区二区三区小说| 欧美视频中文字幕| 午夜精品久久久久影视| 欧美一级片在线| 精品一区二区三区免费视频| 久久免费视频色| 成人免费观看av| 亚洲人精品午夜| 欧美日韩三级在线| 麻豆极品一区二区三区| 精品sm在线观看| 岛国精品一区二区| 一区二区成人在线| 91精品国产色综合久久| 久久成人免费网|