博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
计算器
阅读量:6991 次
发布时间:2019-06-27

本文共 1576 字,大约阅读时间需要 5 分钟。

using System.Windows.Forms;

namespace 朱华建

{
public partial class Form1 : Form
{
public static int Count = 0;

public static int right = 0;

public Form1()
{
InitializeComponent();
}

private void RandomNum()

{

Random ran = new Random();

int a1, a2;

a1 = ran.Next(1, 101);

a2 = ran.Next(1, 101);

textBox1.Text = a1.ToString();

textBox2.Text = a2.ToString();

textBox3.Text = "";

Count++;

}

private void button4_Click(object sender, EventArgs e)
{
label1.Text = "-";

RandomNum();

}

private void button3_Click(object sender, EventArgs e)

{
label1.Text = "+";

RandomNum();

}

private void button5_Click(object sender, EventArgs e)

{
label1.Text = "*";

RandomNum();

}

private void button6_Click(object sender, EventArgs e)

{
label1.Text = "/";

RandomNum();

}

private void textBox3_KeyDown(object sender, KeyEventArgs e)

{
int m;

m = int.Parse(textBox1.Text) + int.Parse(textBox2.Text);

m = int.Parse(textBox1.Text) - int.Parse(textBox2.Text);

m = int.Parse(textBox1.Text) * int.Parse(textBox2.Text);

m = int.Parse(textBox1.Text) / int.Parse(textBox2.Text);

if (e.KeyCode == Keys.Enter)

{

if (textBox3.Text == m.ToString())

right++;

RandomNum();

}

}

private void button2_Click(object sender, EventArgs e)

{
textBox3.Enabled = false;

Form2 frm2 = new Form2();

frm2.ShowDialog();

}

private void button1_Click(object sender, EventArgs e)

{
RandomNum();
}

private void Form1_Load(object sender, EventArgs e)

{

}

}
}

代码敲出来了,可是为什么运行不了呢,查找了各种资料综合了一下但还是发现不了问题在哪。

实在是解决不了了,这样就交了都感觉怪不好意思的,本来想着不交了,但自己辛辛苦苦做到这样了,不交,自己岂不是白忙活了。

还请老师指出错误,我好做出改正,谢谢老师了。

转载于:https://www.cnblogs.com/zhu0519/p/4857166.html

你可能感兴趣的文章
PIE SDK 距离分类和最大似然分类
查看>>
Add、Commit和Push
查看>>
NPInter数据集的奇葩标号的出坑秘籍
查看>>
Angular2地图的使用、地图画线、高德底图切换、图标变换等
查看>>
opencv Mat.at
查看>>
Android中android:visibility的3中属性的剖析
查看>>
SharePoint 客户端对象模型 多选查阅项赋值
查看>>
spring前两天复习
查看>>
动手动脑
查看>>
网络流(二)最大流的增广路算法
查看>>
IIS负载均衡-Application Request Route详解第四篇:使用ARR实现三层部署架构(转载)...
查看>>
TList To DataTable
查看>>
Cache.Insert 方法(摘自MSDN)
查看>>
Duck typing
查看>>
每日一记--索引/过滤器
查看>>
Struts2的CRUD操作
查看>>
A Simple Problem with Integers
查看>>
WampServer中MySQL中文乱码解决
查看>>
Codeforces-938D-Buy a Ticket(最短路设虚拟节点+Dijk优先队列优化)
查看>>
电商打折套路分析 —— Python数据分析练习
查看>>