码迷,mamicode.com
首页 > Windows程序 > 详细

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

时间:2017-05-02 10:10:18      阅读:268      评论:0      收藏:0      [点我收藏+]

标签:text   component   forms   partial   rgs   .text   run   win   sqrt   

 

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

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)
        {

        }
    }
}

  

 

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

标签:text   component   forms   partial   rgs   .text   run   win   sqrt   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!