Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- public partial class RekenToets : System.Web.UI.Page
- {
- public List<Int32> randomSum = new List<int>();
- protected void Page_Load(object sender, EventArgs e)
- {
- }
- protected void maakSommen_Click(object sender, EventArgs e)
- {
- Random generator = new Random();
- int random = Int32.Parse(amountCeiling.Text);
- for (int i = 0; i < 5; i++)
- {
- int Getal = generator.Next(random) + 1;
- randomSum.Add(Getal);
- }
- sum1.Text = "1 X " + randomSum[0];
- sum2.Text = "2 X " + randomSum[1];
- sum3.Text = "3 X " + randomSum[2];
- sum4.Text = "4 X " + randomSum[3];
- sum5.Text = "5 X " + randomSum[4];
- }
- protected void showScore_Click(object sender, EventArgs e)
- {
- int sum1 = 1 * randomSum[0];
- int sum2 = 2 * randomSum[1];
- int sum3 = 3 * randomSum[2];
- int sum4 = 4 * randomSum[3];
- int sum5 = 5 * randomSum[4];
- if (sum1 == Convert.ToInt32(txtSum1.Text))
- {
- goodFalse1.Text = " Goed";
- }
- else if (sum1 != Convert.ToInt32(txtSum1.Text))
- {
- goodFalse1.Text = "Fout";
- }
- if (sum2 == Convert.ToInt32(txtSum2.Text))
- {
- goodFalse2.Text = " Goed";
- }
- else if (sum2 != Convert.ToInt32(txtSum2.Text))
- {
- goodFalse2.Text = "Fout";
- }
- if (sum3 == Convert.ToInt32(txtSum3.Text))
- {
- goodFalse3.Text = " Goed";
- }
- else if(sum3 != Convert.ToInt32(txtSum3.Text))
- {
- goodFalse3.Text = "Fout";
- }
- if (sum4 == Convert.ToInt32(txtSum4.Text))
- {
- goodFalse4.Text = " Goed";
- }
- else if(sum4 != Convert.ToInt32(txtSum4.Text))
- {
- goodFalse4.Text = "Fout";
- }
- if (sum5 == Convert.ToInt32(txtSum5.Text))
- {
- goodFalse5.Text = " Goed";
- }
- else if(sum5 != Convert.ToInt32(txtSum5.Text))
- {
- goodFalse5.Text = "Fout";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement