Arithmetic of integers

Source: Internet
Author: User

namespacejisuanqi{ Public Partial classForm1:form { PublicForm1 () {InitializeComponent (); }         Public Static intCount =0;  Public Static intright =0; Private voidRandomnum () {Random rad=NewRandom (); intm1,m2; M1= Rad. Next (1,101); M2= Rad. Next (1,101); TextBox1. Text=M1.            ToString (); TextBox2. Text=m2.            ToString (); TextBox3. Text=""; Count++; }        Private voidJisuan () {Random js=NewRandom (); intA, B; A= js. Next ( One); b= js. Next ( One); TextBox1.Text=a.tostring (); TextBox2.Text=b.tostring (); Count++; }        Private voidTextbox4_keydown (Objectsender, KeyEventArgs e) {            stringFuhao; Fuhao=Textbox4.text; if(Fuhao = ="+") {Lable1. Text="+"; }                           Else if(Fuhao = ="-") {Lable1. Text="-"; }            Else if(Fuhao = ="*") {Lable1. Text="*"; }           Else{label0. Text="/"; }        }            Private voidButton1_Click (Objectsender, EventArgs e)            {Jisuan (); }            Private voidTextbox3_keydown (ObjectSender,eventargs e) {                intTxt3; if(Textbox4.text = ="+") {Txt3=int. Parse (TextBox1.Text) +int. Parse (TextBox2.                Text); }                Else if(Textbox4.text = ="-") {Txt3=int. Parse (TextBox1.Text)-int. Parse (TextBox2.                Text); }                Else if(Textbox4.text = ="*") {Txt3=int. Parse (TextBox1.Text) *int. Parse (TextBox2.                Text); }                 Else{txt3=int. Parse (TextBox1.Text)/int. Parse (TextBox2.                Text); }                if(E.keycode = =Keys. Enter) {if(TextBox3. Text = =Txt3. ToString ()) { Right++; TextBox3. Text="";                    Jisuan (); }                   }            }        }    }}namespacejisuanqi{ Public Partial classForm2:form { PublicForm2 () {InitializeComponent (); }        Private voidButton2_Click (Objectsender, EventArgs e) {textbox3.enabled=false; NewForm2 ().        ShowDialog (); }         Public Partial classForm2:form { PublicForm2 () {InitializeComponent (); }            Private voidForm2_load (Objectsender, EventArgs e) {TextBox1.Text=Form1.Count.ToString (); TextBox2.Text= (((form1.right)/(Double) (Form1.count)) * -). ToString () +"%"; }        }          }

Operation Result:

Summarize:

I do the form program, I think the form program is relatively simple, the console program does not know where to start. I do this program more time-consuming, with 5 hours, before the C # class, practice the addition training, I thought it would be very simple and quick to do it, but in the time of doing a lot of tests to succeed, so, I think I usually practice not enough, so I will add practice later.

Arithmetic of integers

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.