⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 Visual C#2005程序设计教程
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WinApp8_4数组最大最小值
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.Text = "数组中的最大与最小元素值";
            int[] array = new int[] { 34, 91, 83, 56, 29, 93, 56, 12, 88, 72 };
            int max = array[0], min = array[0];
            label1.Text = "数组中各元素的值为:\n";
            for (int i = 0; i < array.Length; i++)
            {
                if (array[i] > max)
                    max = array[i];
                if (array[i] < min)
                    min = array[i];
                label1.Text += string.Format("{0,-5:#}", array[i]);
            }
            label1.Text += "\n数组中的最大元素值为:" + max;
            label1.Text += "\n数组中的最小元素值为:" + min;
        }
    }
}

⌨️ 快捷键说明

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