[AppleScript] 纯文本查看 复制代码 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mark
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int count = 0;
private void button1_Click(object sender, EventArgs e)
{
lbScore.Items.Add(txtScore.Text.Trim());
txtScore.Text = "";
count++;
}
private void btnClear_Click(object sender, EventArgs e)
{
lbScore.Items.Clear();
}
private void btnCaculate_Click(object sender, EventArgs e)
{
double sum = 0;
double max = 0;
double min = 0;
double average = 0;
foreach (double c in lbScore.Items)
{
sum += c;
max = Math.Max(max, c);
min = Math.Max(min, c);
average = (sum - max - min) /(count-2);
}
lblResult.Text = "最大数:" + max.ToString()+"\n" + "最小数:" + min.ToString() +"\n"+ "平均数:" + average.ToString();
}
}
}
|