Arithmetic of the second assignment 1-10

Source: Internet
Author: User

Form1.cs
Using system;using system.collections.generic;using system.componentmodel;using system.data;using System.Drawing; Using system.linq;using system.text;using system.windows.forms;namespace windowss{public partial class Form1:form {public Form1 () {InitializeComponent (); } public static int Count = 0;//The total number of topics public static int right = 0;//Correct topic total number private void B Utton1_click (object sender, EventArgs e) {randomnum (); }//generates a random number of 1-10 and displays the private void Randomnum () {Random ran=ne in the text box W Random (); int n1,n2; N1=ran. Next (1,11);//Generate a number N2 = ran. Next (1, 11);//generates a number TextBox1.Text = N1. ToString (); TextBox2.Text = n2. ToString (); TextBox3.Text = ""; count++; } private void TextboX3_keydown (object sender, KeyEventArgs e) {int txb; String Tb=textbox4.text; Switch (TB) {case "+": Txb =int. Parse (TextBox1.Text) +int. Parse (TextBox2. Text); break; Case "-": Txb =int. Parse (TextBox1. Text)-int. Parse (TextBox2.Text); Break Case "*": TXB =int. Parse (TextBox1. Text) *int. Parse (TextBox2. Text); break; DEFAULT:TXB =int. Parse (TextBox1. Text)/int. Parse (TextBox2. Text); break; } if (E.keycode ==keys.enter) {if (TextBox3.Text = = tx B.tostring ()) right++; Randomnum (); }} private void Button2_Click (object sender, EventarGS e) {textbox3.enabled = false; Form2 frm2 = new Form2 (); Frm2. ShowDialog (); private void Button3_Click (object sender, EventArgs e) {new FORM3 (). Show (); private void Label3_click (object sender, EventArgs e) {textbox4.text = "+"; private void Label4_click (object sender, EventArgs e) {textbox4.text = "-"; private void Label5_click (object sender, EventArgs e) {textbox4.text = "*"; private void Label6_click (object sender, EventArgs e) {textbox4.text = "/"; private void Button2_click_1 (object sender, EventArgs e) { textbox3.enabled = false; Form2 frm2 = new Form2 (); Frm2. ShowDialog (); private void Button3_click_1 (object sender, EventArgs e) {new FORM3 (). Show (); } } }
From2.cs
Using system;using system.collections.generic;using system.componentmodel;using system.data;using System.Drawing; Using system.linq;using system.text;using system.windows.forms;namespace windowss{public partial class Form2: Form {public Form2 () { InitializeComponent (); } private void Form2_load (object sender, EventArgs e) { TextBox1.Text = Form1.Count.ToString ();//Total number of topics TextBox2.Text = Form1.right.ToString ();//correct number of topics TextBox3.Text = ((Form1.right/(double) (form1.count)) * 100). ToString () + "%";//title correct rate } private void Button1_Click (object sender, EventArgs e) {this . Close ();}} }
From3
Using system.data;using system.drawing;using system.linq;using system.text;using system.windows.forms;namespace windowss{public Partial class Form3:form {public Form3 () { InitializeComponent (); } private void Button1_Click (object sender, EventArgs e) {this . Close ();}} }

Arithmetic of the second assignment 1-10

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.