c#第一个程序-计算平方根

上课教的内容。做笔记了。

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)
        {
            double a = double.Parse(textBox1.Text);
            double retrun = Math.Sqrt(a);
            label1.Text = a + "的平方跟是:" + retrun.ToString() ;//ToString转换字符串。
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}

  

原文地址:https://www.cnblogs.com/xishaonian/p/6794300.html