zoukankan      html  css  js  c++  java
  • 二柱子在线答题

    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;
    using System.IO;

    namespace 软工
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }

            private void textBox1_TextChanged(object sender, EventArgs e)
            {

            }

            private void button1_Click(object sender, EventArgs e)
            {

                int[] ans = new int[30];
                int [] number = new int[60];
                Random random = new Random();
                
                for(int i=0;i<60;i++)
                {
                    number[i] = random.Next(0, 100);
                }
                for (int i = 0; i < 30; i++)
                {
                    int a = random.Next(0, 3);
                    if (number[i + 30] != 0 && (number[i] % number[i + 30]) == 0)
                    {
                        textBox4.AppendText(number[i] + "/" + number[i + 30] + "=" + " ");
                        ans[i] = number[i] / number[i + 30];
                        textBox1.AppendText(Convert.ToString(ans[i]) + " ");
                    }
                    else if (a == 1)
                    {
                        textBox4.AppendText(number[i] + "-" + number[i + 30] + "=" + " ");
                        ans[i] = number[i] - number[i + 30];
                        textBox1.AppendText(Convert.ToString(ans[i]) + " ");
                    }
                    else if (a == 0)
                    {
                        textBox4.AppendText(number[i] + "*" + number[i + 30] + "=" + " ");
                        ans[i] = number[i] * number[i + 30];
                        textBox1.AppendText(Convert.ToString(ans[i]) + " ");
                    }
                    else
                    {
                        textBox4.AppendText(number[i] + "+" + number[i + 30] + "=" + " ");
                        ans[i] = number[i] + number[i + 30];
                        textBox1.AppendText(Convert.ToString(ans[i]) + " ");
                    }
                }
                
            }

            private void button2_Click(object sender, EventArgs e)
            {
                textBox1.Visible = true;
                string s = textBox5.Text;
                string[] ss = s.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                string a = textBox1.Text;
                string[] ans = a.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                if (ss.Length < 30)
                {
                    MessageBox.Show("未答完题!");
                    return;
                }
                for (int i = 0; i < 30; i++)
                {
                    if (ss[i] == null)
                    {
                        MessageBox.Show("有空答案");
                        return;
                    }
                   
                }
                for (int i = 0; i < 30; i++)
                {
                    if (Convert.ToInt32 ( ss[i]) ==Convert.ToInt32 (ans[i]))
                        textBox6.AppendText("正确" + " ");
                    if (Convert.ToInt32(ss[i]) != Convert.ToInt32(ans[i]))
                        textBox6.AppendText("错误" + " ");
                }
            }

            private void textBox1_TextChanged_1(object sender, EventArgs e)
            {

            }

            private void button4_Click(object sender, EventArgs e)
            {
                Application.Exit();
            }

            private void button3_Click(object sender, EventArgs e)
            {
                
                
                
                SaveFileDialog sfile = new SaveFileDialog();
                sfile.Filter = "错题本|*.text";
                if(sfile.ShowDialog()==DialogResult.OK )
                {
                    StreamWriter sw = new StreamWriter(sfile.FileName);
                    sw.WriteLine(textBox4.Text);
                    sw.Close();

  • 相关阅读:
    一起采坑redis(1)--- Redis Save 与 BGSAVE 的区别
    logstash系列一使用logstash迁移ES数据
    MHA+Atlas+mysql一主一从开启gtid安装配置与实验
    innodb log file size 配置估算以及修改
    linux 硬盘速度测试
    YCSB-压测
    mysql 5.7配置文件参数详解
    mysql 批量插入数据存储过程
    int unsigned实验
    mongodump 备份
  • 原文地址:https://www.cnblogs.com/mengweile/p/10259075.html
Copyright © 2011-2022 走看看