Job. mp4

Source: Internet
Author: User

Job Requirements:

The topic is to write a " software " program that can arithmetic the integer between the 0--10 to receive the integer answer of the user input , and to judge the number of correct and wrong answers when the wrong program ends.

Design ideas:

To design a program that can be arithmetic, it can be done with a console or a Windows Form. I'm using a form.

To design a form structure, you need at least two textbox to receive the random number, and random numbers are used to generate the randomness ().

The user then needs to enter an operator, and then add a textbox to show the result. This is 4, and finally there is a text box that shows the final test results, and I still select the textbox.

Then the label of the operator is displayed, and the operator you want to display the user input is written in the corresponding text box.

Finally, a variety of descriptive labels.

private void Button2_Click (object sender, EventArgs e)
         {
             Csrdn ();
             T = 0;
             F = 0;
             S = 0;
        

By the way, there is also a method for defining a non-return value: public static int T, f,s;

Implement the part of the algorithm:

private void Textbox3_keydown (object sender, KeyEventArgs e)
{

Double X;
if (Label5. Text = = "+")
{
x = Double. Parse (TextBox1.Text) + double. Parse (TextBox2.Text);
}
else if (label5. Text = = "-")
{
x = Double. Parse (TextBox1.Text)-double. Parse (TextBox2.Text);
}
else if (label5. Text = = "*")
{
x = Double. Parse (TextBox1.Text) * Double. Parse (TextBox2.Text);
}
Else
{
x = Double. Parse (TextBox1.Text)/double. Parse (TextBox2.Text);

}
if (E.keycode==keys.enter)
{
if (TextBox3.Text ==x.tostring ())
{
t++;
s++;
Csrdn ();
}
Else
{
                     f++;
                     s++;
                     Csrdn ();
                }
           }

End:

Writing a program like this is far more complicated than I thought, but it took two hours to write the code simply, needless to say, to prepare for it in advance. However, testing does not.

Although the program is completed, but there are many loopholes, such as the fractional processing of the division algorithm, the Infinite repeating decimal in a short period of time can not do, so there is no way and not limit the true value of the decimal place equal, can only be counted wrong, and about the input operator, according to the usual habit of return should start, But also the key to start ... And so many problems.

In short, the user experience is not very good. But this is just the initial version = =.

It'll be fine in the future.

Job. mp4

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.