日期:2014-05-17 浏览次数:21038 次
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace hanshuku
{
class hanshu
{
public const double pi =3.1415;
public static double hu2shishu(double hu)
{
double jiaodu = hu * 180 / pi;
int du = (int)jiaodu;
double m = (jiaodu - du) * 60;
int fen = (int)m;
double s = Math.Round((m - fen) * 60, 2);
string a = du.ToString();
string b = fen.ToString();
string c = s.ToString();
if (b.Length == 1)
b = "0" + b;
int p = c.IndexOf(".");
int n = c.Length;
c = c.Remove(p, 1);
string jiao = a + b + "." + c;
jiaodu = double.Parse(jiao);
return jiaodu;
}
}
}
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;
using hanshuku;
namespace 实验子函数调用
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double hu = double.Parse(this.textBox1.Text.ToString());
&n