form1.cs

来自「用VS描述的 模拟操作系统的先来先服务功能」· CS 代码 · 共 489 行 · 第 1/2 页

CS
489
字号
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace FIFO
{
    public partial class Form1 : Form
    {
        int fi_i = 0;
        int fi_type1 = 0;
        int fi_i1 = 0;
        int fi_i2 = 0;
        int fi_i3 = 0;
        Label[] a = new Label[5];
        int[] fi_ii = new int[5];

        public Form1()
        {
            InitializeComponent();
            chushihua();
            suijishu();
            timer1.Enabled = true;
        }

        public void suijishu()
        {
            Random r1 = new Random();
                fi_i = r1.Next(1, 30);     
        }
       
        public void panduan11(int a, int b, int c)//一一全部调入后再一一执行!
        {
            if (4 * (a++) < 328)
            {
                fi_type1 = 1;
                label4.Text = "CPU正在调入进程1";
            }
            else
                if (4 * (a++) < 556)
                {
                    if (3 * (b++) < 328)
                    {
                        fi_type1 = 2;
                        label4.Text = "CPU正在调入进程2.";
                    }
                    else
                    {
                        if (3 * (b++) < 556)
                        {
                            if (2 * (c++) < 328)
                            {
                                fi_type1 = 3;
                                label4.Text = "CPU正在调入进程3";
                            }
                            else
                            {
                                if (2 * (c++) < 556)
                                {
                                    fi_type1 = 1;
                                    label4.Text = "CPU正在运行进程1";
                                }
                            }
                        }
                        else
                        {
                            fi_type1 = 3;
                            label4.Text = "CPU正在调入进程3";
                        }
                    }
                }
                else
                    if (3 * (b++) < 556)
                    {
                        fi_type1 = 2;
                        label4.Text = "CPU正在运行进程2";
                    }
                    else
                        if (2 * (c++) < 556)
                        {
                            fi_type1 = 3;
                            label4.Text = "CPU正在运行进程3";
                        }
                        else
                        {
                            fi_type1 = 7;
                            label4.Text = "结束!";
                        }
        }

        public void panduan12(int a, int b, int c)//调入一个就执行一个!
        {
            if (4 * (a++) < 556)
            {
                if (4 * (a++) < 328)
                {
                    fi_type1 = 1;
                    label4.Text = "CPU正在调入进程1";
                }
                else
                {
                    fi_type1 = 1;
                    label4.Text = "CPU正在运行进程1";
                }
            }
            else
                if (3 * (b++) < 556)
                {
                    if (3 * (b++) < 328)
                    {
                        fi_type1 = 2;
                        label4.Text = "CPU正在调入进程2";
                    }
                    else
                    {
                        fi_type1 = 2;
                        label4.Text = "CPU正在运行进程2";
                    }
                }
                else
                {
                    if (2 * (c++) < 556)
                    {
                        if (2 * (c++) < 328)
                        {
                            fi_type1 = 3;
                            label4.Text = "CPU正在调入进程3";
                        }
                        else
                        {
                            fi_type1 = 3;
                            label4.Text = "CPU正在调运行进程3";
                        }
                    }
                    else
                    {
                        fi_type1 = 7;
                        label4.Text = "结束!";
                    }
                }
        }

        public void panduan13(int a, int b, int c)
        {
            if (4 * (a++) < 556)
            {
                if (4 * (a++) < 328)
                {
                    fi_type1 = 1;
                    label4.Text = "CPU正在调入进程1";
                }
                else
                {
                    if (3 * (b++) < 328)
                    {
                        fi_type1 = 2;
                        label4.Text = "CPU正在调入进程2";
                    }
                    else
                    {
                        fi_type1 = 1;
                        label4.Text = "CPU正在运行进程1";
                    }
                }
            }
            else
            {
                if (3 * (b++) < 556)
                {
                    if (2 * (c++) < 328)
                    {
                        fi_type1 = 3;
                        label4.Text = "CPU正在调入进程3";
                    }
                    else
                    {
                        fi_type1 = 2;
                        label4.Text = "CPU正在运行进程2";
                    }
                }
                else
                {
                    if (2 * (c++) < 556)
                    {
                        fi_type1 = 3;
                        label4.Text = "CPU正在运行进程3";
                    }
                    else
                    {
                        fi_type1 = 7;
                        label4.Text = "结束!";
                    }
                }
            }
        }

        public void panduan14(int a, int b, int c)
        {
            if (4 * (a++) < 556)
            {
                if (4 * (a++) < 328)
                {
                    fi_type1 = 1;
                    label4.Text = "CPU正在调入进程1";
                }
                else
                {
                    fi_type1 = 1;
                    label4.Text = "CPU正在运行进程1";
                }
            }
            else
            {
                if (3 * (b++) < 556)
                {
                    if (3 * (b++) < 328)
                    {
                        if (2 * (c++) < 328)
                        {
                            fi_type1 = 2;
                            label4.Text = "CPU正在调入进程2";
                        }
                    }
                    else
                    {
                        if (3 * (b++) < 556)
                        {
                            if (2 * (c++) < 328)
                            {
                                fi_type1 = 3;
                                label4.Text = "CPU正在调入进程3";
                            }
                            else
                            {
                                if (2 * (c++) < 556)
                                {
                                    fi_type1 = 2;
                                    label4.Text = "CPU正在运行进程2";
                                }
                            }
                        }
                        else

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?