Advertisement
Guest User

Untitled

a guest
May 24th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.28 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7.  
  8. public partial class RekenToets : System.Web.UI.Page
  9. {
  10.     public List<Int32> randomSum = new List<int>();
  11.  
  12.     protected void Page_Load(object sender, EventArgs e)
  13.     {
  14.  
  15.     }
  16.  
  17.     protected void maakSommen_Click(object sender, EventArgs e)
  18.     {
  19.         Random generator = new Random();
  20.         int random = Int32.Parse(amountCeiling.Text);
  21.  
  22.  
  23.  
  24.         for (int i = 0; i < 5; i++)
  25.         {
  26.             int Getal = generator.Next(random) + 1;
  27.  
  28.             randomSum.Add(Getal);
  29.         }
  30.  
  31.         sum1.Text = "1 X " + randomSum[0];
  32.         sum2.Text = "2 X " + randomSum[1];
  33.         sum3.Text = "3 X " + randomSum[2];
  34.         sum4.Text = "4 X " + randomSum[3];
  35.         sum5.Text = "5 X " + randomSum[4];
  36.  
  37.     }
  38.  
  39.     protected void showScore_Click(object sender, EventArgs e)
  40.     {
  41.  
  42.         int sum1 = 1 * randomSum[0];
  43.         int sum2 = 2 * randomSum[1];
  44.         int sum3 = 3 * randomSum[2];
  45.         int sum4 = 4 * randomSum[3];
  46.         int sum5 = 5 * randomSum[4];
  47.  
  48.         if (sum1 == Convert.ToInt32(txtSum1.Text))
  49.         {
  50.             goodFalse1.Text = " Goed";
  51.         }
  52.         else if (sum1 != Convert.ToInt32(txtSum1.Text))
  53.         {
  54.             goodFalse1.Text = "Fout";
  55.         }
  56.  
  57.         if (sum2 == Convert.ToInt32(txtSum2.Text))
  58.         {
  59.             goodFalse2.Text = " Goed";
  60.         }
  61.         else if (sum2 != Convert.ToInt32(txtSum2.Text))
  62.         {
  63.             goodFalse2.Text = "Fout";
  64.         }
  65.  
  66.         if (sum3 == Convert.ToInt32(txtSum3.Text))
  67.         {
  68.             goodFalse3.Text = " Goed";
  69.         }
  70.         else if(sum3 != Convert.ToInt32(txtSum3.Text))
  71.         {
  72.             goodFalse3.Text = "Fout";
  73.         }
  74.  
  75.         if (sum4 == Convert.ToInt32(txtSum4.Text))
  76.         {
  77.             goodFalse4.Text = " Goed";
  78.         }
  79.         else if(sum4 != Convert.ToInt32(txtSum4.Text))
  80.         {
  81.             goodFalse4.Text = "Fout";
  82.         }
  83.         if (sum5 == Convert.ToInt32(txtSum5.Text))
  84.         {
  85.             goodFalse5.Text = " Goed";
  86.         }
  87.         else if(sum5 != Convert.ToInt32(txtSum5.Text))
  88.         {
  89.             goodFalse5.Text = "Fout";
  90.         }
  91.  
  92.     }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement