Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace quizmaster
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- Random r = new Random();
- int ra, choice, right;
- private void button1_Click(object sender, EventArgs e)
- {
- int counter = 0;
- right = 0;
- choice = 1;
- while (counter != 100)
- {
- ra = r.Next(1, 4);
- if (ra == choice)
- {
- right++;
- }
- counter++;
- }
- MessageBox.Show(right.ToString());
- }
- private void button2_Click(object sender, EventArgs e)
- {
- int counter = 0;
- int od = 1;
- right = 0;
- choice = 1;
- while (counter != 100)
- {
- ra = r.Next(1, 4);
- while (od == choice || od == ra)
- {
- od++;
- }
- while (choice == 1 || choice == od)
- {
- choice++;
- }
- if (choice == ra)
- {
- right++;
- }
- counter++;
- od = 1;
- choice = 1;
- }
- MessageBox.Show(right.ToString());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement