用C++实现简单的生成随机数目的四则运算的题目的程序

2021-05-15 18:29

阅读:405

标签:c++实现   soscw   http   随机数   com   temp   简单   ring   []   

        private void button1_Click(object sender, EventArgs e)
        {
            double n = Convert.ToDouble(textBox3.Text);
            double m = Convert.ToDouble(textBox2.Text);
            double q = Convert.ToDouble(textBox1.Text);
            richTextBox1.Text = "";
            double[] a = new double[2 * (int)q];
            Random r = new Random();
            for (int i = 0; i             {
                double temp = r.Next((int)m, (int)n);
                a[i] = temp;
            }
            for (int i = 0; i             {
                string c = "+";
                double b = a[i] + a[i + (int)q];
                if (b                 c = "*";
                if (b > (int)n / 2 && b                 c = "+";
                if (b > (int)n && b                 c = "/";
                if (b > (int)n * 1.5 && b a[i + (int)q])
                c = "-";
                richTextBox1.AppendText(a[i].ToString() + (c) + a[i + (int)q].ToString() + ("=") + System.Environment.NewLine);
            }
        }
    }
}技术分享图片技术分享图片

用C++实现简单的生成随机数目的四则运算的题目的程序

标签:c++实现   soscw   http   随机数   com   temp   简单   ring   []   

原文地址:https://www.cnblogs.com/lwan/p/9750806.html


评论


亲,登录后才可以留言!