• 二柱子在线答题


    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();

  • 相关阅读:
    NSURL 的简单实用
    动画demo
    UIScrollView的简单页面
    关于UITableview(更新)
    添加手势
    多线程
    IOS 瀑布流
    高低字节序转换(htonl、ntohl、htons、ntohs函数)
    Xcode个版本
    网址
  • 原文地址:https://www.cnblogs.com/mengweile/p/10259075.html
Copyright © 2020-2023  润新知