.
.
Saturday, October 24, 2009
Multiplication Game
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;
using System.Threading;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public int rgt = 0;
public int wng = 0;
public Int32 prod;
public int uprob;
Random random = new Random();
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
uprob = Convert.ToInt32(textBox1.Text);
int num1 = random.Next(1, 100);
int num2 = random.Next(1, 100);
Int32 prod = num1 * num2;
textBox2.Text = Convert.ToString(num1);
textBox3.Text = Convert.ToString(num2);
}
private void button6_Click(object sender, EventArgs e)
{
if (((Convert.ToInt32(textBox2.Text)*(Convert.ToInt32(textBox3.Text)) == Convert.ToInt32(textBox4.Text))))
{
textBox6.Text = "Congratulations! You're correct.";
textBox5.Text = Convert.ToString(prod);
rgt = rgt + 1;
}
else
{
textBox6.Text = "Uh, oh! You need more practice.";
textBox5.Text = Convert.ToString(prod);
wng = wng + 1;
}
Int32 uansr = Convert.ToInt32(textBox4.Text);
Int32 m1 = Convert.ToInt32(textBox2.Text);
Int32 m2 = Convert.ToInt32(textBox3.Text);
Int32 mm = m1 * m2;
int num1 = random.Next(1, 100);
int num2 = random.Next(1, 100);
textBox2.Text = Convert.ToString(num1);
textBox3.Text = Convert.ToString(num2);
Thread.Sleep(1000);
textBox6.Text = "";
textBox5.Text = "";
textBox4.Text = "";
uprob = uprob -1;
textBox1.Text = Convert.ToString(uprob);
}
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment