计应191(西)申振翔 口算题卡

计应191(西)申振翔 口算题卡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 WindowsFormsApp5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int a, b;
string op;
double result;
Random rnd = new Random();

private void button2_Click(object sender, EventArgs e)
{
string str = txtAnswer.Text;
double d = double.Parse(str);
string disp = " " + a + op + b + "=" + str + " ";
if (d == result)
disp += "√";
else
disp += "x";
listBox1.Items.Add(disp); //在list中输出
}

private void button1_Click(object sender, EventArgs e)
{
a = rnd.Next(9) + 1;
b = rnd.Next(9) + 1;
int c = rnd.Next(4);
switch (c) //生成随机符号
{
case 0:op = "+";result = a + b;break;
case 1: op = "-"; result = a - b; break;
case 2: op = "*"; result = a * b; break;
case 3: op = "/"; result = (int)(((double)a / b)*100)*1.0/100; break; //保留两位小数
}
label1.Text = a.ToString();
label2.Text = op;
label3.Text = b.ToString();
txtAnswer.Text = " "; //输出随机题目

}
}
}

上一篇:扩展的Sobel 算子


下一篇:安装sphinx报错(undefined reference to `libiconv_open' 、undefined reference to `libiconv'、undefined reference to `libiconv_close'、make[1]: *** No rule to make target `all'. Stop. 、make: *** [all-recursive