代碼:
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 bt
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)//標籤1,用於顯示人民幣
{
}
private void label2_Click(object sender, EventArgs e)//標籤2,用於顯示匯率
{
}
private void label3_Click(objectsender,EventArgs e) //標籤3,用於顯示美元
{
}
private void textBox1_TextChanged(objectsender, EventArgs e)//文本框1,用於輸入人民幣
{
}
private void textBox2_TextChanged(object sender, EventArgs e) //文本框2,用於輸入匯率
{
}
private void textBox3_TextChanged(object sender, EventArgs e) //文本框3,用於輸入美元
{
}
private void b1_Click(object sender,EventArgs e) //按鈕1清屏函數。
{
t1.Text = "";
t2.Text = "";
t3.Text = "";
}
private void b2_Click(object sender,EventArgs
e) //按鈕2¥-$轉換
{ t3.Text=Convert.ToString(Convert.ToDouble(t1.Text) / Convert.ToDouble(t2.Text));
}
private void b3_Click(objectsender,EventArgse) //按鈕3$-¥轉換
{
t1.Text=Convert.ToString(Convert.ToDouble(t3.Text) * Convert.ToDouble(t2.Text));
}
private void b4_Click(objectsender,EventArgs e) //退出按鈕
{
Application.Exit();
}
}
}
C#實驗課:人民幣和美元兌換
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.