using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public static int count = 0;
private int t = 60;
public static int right = 0;
public int result;
private void button5_Click(object sender, EventArgs e)
{
try
{
t = int.Parse(textBox4.Text);
if (t > 0)
{
label2.Text = t.ToString();
textBox4.Enabled = false;
}
else
{
MessageBox.Show("輸入數不能小於1,不能也帶小數!");
return;
}
}
catch (Exception)
{
throw;
}
timer1.Enabled = true;
timer1.Interval = 1000;
timer1.Start();
Random();
}
private void Random()
{
Random ab = new Random();
int a, b;
a = ab.Next(1, 11);
b = ab.Next(1, 11);
textBox1.Text = a.ToString();
textBox2.Text = b.ToString();
textBox3.Text = "";
count++;
}
private void timer1_Tick(object sender, EventArgs e)
{
if (t <= 0)
{
timer1.Enabled = false;
textBox3.Enabled = false;
MessageBox.Show("時間到!");
textBox3.Enabled = false;
}
t = t - 1;
label2.Text = t.ToString();
}
private void button1_Click(object sender, EventArgs e)
{
label3.Text = "+";
}
private void button2_Click(object sender, EventArgs e)
{
label3.Text = "-";
}
private void button3_Click(object sender, EventArgs e)
{
label3.Text ="*";
}
private void button4_Click(object sender, EventArgs e)
{
label3.Text = "/";
}
private void textBox3_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
switch (label3.Text)
{
case "+":
result = int.Parse(textBox1.Text) + int.Parse(textBox2.Text);
break;
case "-":
result = int.Parse(textBox1.Text) - int.Parse(textBox2.Text);
break;
case "*":
result = int.Parse(textBox1.Text) * int.Parse(textBox2.Text);
break;
case "/":
result = int.Parse(textBox1.Text) / int.Parse(textBox2.Text);
break;
}
if (textBox3.Text == result.ToString())
{
right++;
Random();
}
else
{
Random();
}
}
}
private void button6_Click(object sender, EventArgs e)
{
textBox3.Enabled = false;
Form2 frm2 = new Form2();
frm2.ShowDialog();
}
private void textBox3_KeyPress(object sender, KeyPressEventArgs e)
{
//在網上找到的關於用戶輸入非數字的判斷,可是並不完善 , 若是設置messagebox則會在按下回車鍵時彈出。
if (!char.IsDigit(e.KeyChar))
{
e.Handled = true;
//MessageBox.Show("請輸入數字");
}
}
}
}
psp |
計劃 |
3h |
|
估計這個任務須要多少時間 |
3h |
|
開發 |
3.1h |
|
需求分析 |
10 |
|
生成設計文檔 |
30 |
|
設計複審 |
10 |
|
代碼規範 |
10 |
|
具體設計 |
60 |
|
具體編碼 |
40 |
|
代碼複審 |
10 |
|
測試 |
20 |
|
報告 |
23 |
|
測試報告 |
10 |
|
計算工做量 |
3 |
|
過後總結,並提出改進計劃 |
10 |
|
|
|
我倆從網上找了很多例子,跟着勇勇哥學到了很多東西,我看不懂的代碼都問他,他也很樂意給我說,今天您告訴咱們複製粘貼很差,咱們也懂得,咱們看到別人的代碼以後呢,會去理解其中的意思,知其因此然。看成例子用。