Lao Chen and the small stone

Source: Internet
Author: User

Namespace small stone and Lao Chen {public partial class Form1:form {public Form1 () {Initializecompo        Nent (); } public static int Count = 0;//The total number of topics public static int right = 0;//Correct topic total number public static int connt =        0;//error problem number int j = 0;        String A;        String B;        int C; private void Label3_click (object sender, EventArgs e) {TB4.        Text = "+"; The private void Label4_click (object sender, EventArgs e) {TB4.        Text = "-"; The private void Label5_click (object sender, EventArgs e) {TB4.        Text = "*"; The private void Label6_click (object sender, EventArgs e) {TB4.        Text = "/";            private void Button3_Click (object sender, EventArgs e) {a = Textbox6.text;            b = Textbox8.text;            string str = Textbox7.text;       Switch (str) {case ' + ':             Class1 j = new Class1 ();                    J.ji (A, B, out C);                Break                    Case "-": Class1 J2 = new Class1 ();                    J2.ji2 (A, B, out C);                Break                    Case "*": Class1 J3 = new Class1 ();                    J3.ji3 (A, B, out C);                Break                    Case "/": Class1 J4 = new Class1 ();                    J4.ji4 (A, B, out C);            Break } if (Textbox8.text = = "" | |                Textbox6.text = = "")//Do not remember the total number of questions when the problem is not imported; {MessageBox.Show ("cannot be empty");            count--;                } else if (TextBox3.Text = = c.tostring ()) {right++; MessageBox.Show ("Answer right!")            ");                } else if (textbox3.text! = c.tostring ()) {connt++; MessageBox.Show ("Answer the wrong!")            ");      } count++;      Textbox6.clear ();            Textbox7.clear ();            Textbox8.clear ();            Textbox3.clear ();                    TextBox1.Text = Count.tostring (); private void Button2_Click (object sender, EventArgs e) {Form2 form = new Form2 ()                ; Form.        ShowDialog ();  } private void Button1_Click (object sender, EventArgs e) {//Save parent's math problem StreamWriter WR            = File.appendtext ("G1.txt"); Url WriteLine (tb1.            Text); Url            Close ();            StreamWriter wr1 = File.appendtext ("G2.txt"); Wr1. WriteLine (TB2.            Text); Wr1.            Close ();            StreamWriter WR2 = File.appendtext ("G3.txt"); Wr2. WriteLine (TB4.            Text); Wr2.            Close (); Tb1.            Clear (); TB2.            Clear (); TB4.        Clear ();            } private void Button4_Click (object sender, EventArgs e) {try//prevents the exception from occurring when the problem is done directly to the Form2 form,,,       {         j + +;                String[] JG = new string[100];                JG = File.ReadAllLines ("G1.txt");                Textbox6.text = Jg[j];                string[] jg2 = new string[100];                JG2 = File.ReadAllLines ("G3.txt");                Textbox7.text = Jg2[j];                string[] jg3 = new string[100];                JG3 = File.ReadAllLines ("G2.txt");                Textbox8.text = Jg3[j];                    if (jg2[j] = = "/" && jg3 [j]== "0") {MessageBox.Show ("Denominator cannot be zero");//Determine if the denominator is zero,                    j + +;                    Textbox6.clear ();                    Textbox7.clear ();                Textbox8.clear ();                }} catch {Form2 form = new Form2 (); Form.            ShowDialog ();            }} private void Button5_click (object sender, EventArgs e) {Form3 form3 = new FORM3 (); Form3.        ShowDialog ();      }    }   } 

define a Class1 class

Namespace small stone and Lao Chen
{
Class Class1
{
public void Ji (string x, string y, out int s)
{
s = Int. Parse (x) + int. Parse (y);
}
public void Ji2 (string x, string y, out int s)
{
s = Int. Parse (x)-Int. Parse (y);
}
public void Ji3 (string x, string y, out int s)
{
s = Int. Parse (x) * int. Parse (y);
}
public void Ji4 (string x, string y, out int s)
{
s = Int. Parse (x)/Int. Parse (y);
}
}
}








PSP consumption


Lao Chen and the small stone

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.