作业2

作者: 羊羊羊SHADOW | 来源:发表于2018-10-18 10:02 被阅读0次

    #作业要求


    #代码

    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 计算器 {

    public partial class Form1 : Form {

    public Form1() {

    InitializeComponent(); }

    private void button1_Click(object sender, EventArgs e) {

    float num1 = 0;

    float num2 = 0;

    float result = 0;

    num1 = float.Parse(textBox1.Text); //将文本框输入的字符转换成数值

    num2 = float.Parse(textBox2.Text);

    result = num1 * num2; textBox3.Text = result.ToString(); //将数值转换成字符 }

    private void button2_Click(object sender, EventArgs e) {

    textBox1.Text = "";

    textBox2.Text = "";

    textBox3.Text = ""; }

    #效果

    作业2

    相关文章

      网友评论

          本文标题:作业2

          本文链接:https://www.haomeiwen.com/subject/hrqjzftx.html