Software Engineering--second assignment

Source: Internet
Author: User

      • Title: Please write a "software" that can automatically generate primary arithmetic topics.           Allow the program to accept the user to enter the answer, and determine the right and wrong. Finally, the total number of pairs/errors is given.

        Requirements Analysis: Basic functions, can meet the user to complete a simple addition, subtraction, multiplication, except operation, each calculation can be counted the number of times, the user gives the answer, can with

        Computer answer match, error and correct will appear the corresponding prompt box!

        Design: Using VS2010 as a platform, written in C # language, with a global variable to record the number of operations, the rest are written with the corresponding control properties, pay special attention to the relationship between shaping and character type, the use if statement for each of the possible choices!

        Code implementation:

        UsingSystem;UsingSystem.Collections.Generic;UsingSystem.ComponentModel;UsingSystem.Data;UsingSystem.Drawing;UsingSystem.Linq;UsingSystem.Text;UsingSystem.Windows.Forms;Namespacewindowsformsapplication1{PublicPartialClassForm1:form {PublicForm1 () {InitializeComponent ();}Privatevoid Domainupdown1_selecteditemchanged (Objectsender, EventArgs e) {}int s =0;Privatevoid Button1_Click (Objectsender, EventArgs e) {if (TextBox1.Text = =null | | TextBox2.Text = =null | | TextBox3.Text = =Null) {MessageBox.Show ("Calculate the number and the answer you fill cannot be empty"); }Else{s = s +1; Label6. Text =S.tostring ();IntA, B;IntC A =Int32.Parse (TextBox1.Text); b =Int32.Parse (TextBox2.Text);if (Combobox1.text = ="Add") {c = a + b; textbox3.text =C.tostring (); }if (Combobox1.text = ="Reducing") {c = a-B; textbox3.text =C.tostring (); }if (Combobox1.text = ="By") {c = a * b; textbox3.text =C.tostring (); }if (Combobox1.text = ="Except") {c = A/b; textbox3.text =C.tostring (); }if (TextBox3.Text = =Textbox4.text) {label4. Text ="Congratulations, calculate right!!!!"; }else {label4. Text ="Sorry, the answer is wrong!!!"; } } }Privatevoid Label2_click (Object sender, EventArgs e) {} private void Form1_Load ( object sender, EventArgs e) {} private void button2_click (object sender, EventArgs e) {TextBox1.Text = ; TextBox3.Text = ; Textbox4.text = ; Combobox1.text = ; Label6. Text =       

        Program run:

        Analysis and Summary: This operation is too simple, because I did not do mixed operation, resulting in the program is not very difficult, but through this study, I will continue to improve it!

        PSP time-consuming statistics:

Software Engineering--second assignment

Related Article

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.