版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、using System;using System Collections Generic;using SystemComponentModel;using System .Data;using SystemDrawing;using System .Text;using System Windows Forms;namespace Calculatorpublic partial class Counter : Formpublic Counter0InitializeComponent();doub1e num1, num2;double result=0;int op;int flag=
2、0;/開始標(biāo)志int sp = 0;/判斷除數(shù)為零時(shí)移除監(jiān)聽int max = 0;/范圍標(biāo)識(shí)int eq=0;Sregion 功能鍵private void on_Click(object sender, EventArgs e) 丿卜始flag = 1;sp = 0;max = 0;thisnumlnput .Text = 0;thistxtlnput .Text =private void off_Click(object sender, EventArgs e) 關(guān)閉flag = 0;sp = 0;max = 0;thisnumlnput .Text =thistxtlnput .Te
3、xt =private void button9_Click(object sender, EventArgs e).,刪除if (flag = l&sp=O)string numstring = thisnumlnput.Text;if (numstring Length 0)string temp = numstringSubstring(0, numstring .Length 一 1): this numinput Text = temp ToString 0;elsethisnumlnput .Text = 0;private void clearedick(object sende
4、r, EventArgs e)/ c;nmax = 0;if (flag = 1)sp = 0;thisnumlnput .Text = 0;thistxtInput .Text =private void delete_Click(object sender, EventArgs e) . Jrimax = 0;if (flag = 1)sp = o;thisnuminput .Text = 0;SendregionSregion 運(yùn)算符private void equal_Click(object sender, EventArgs e) T等:;eq = 1;if (flag = 1 &
5、 sp = 0)max = 0;num2 = Convert ToDouble(this numlnput Text); this txt Input Text 二 num2 ToStringO ;thistxtInput .Text +二二txtInput .Text = null:switch (op)case 1: result = numl 十 num2: break;case 2: result = numl - num2; break;case 3: result = numl * num2: break;case 4:result = numl / num2:break;case
6、 5:result = Math Pow(numl,num2);break;num2);case 6: result = Mod(numl,break;default: return;if (op=4&num2 = 0)this, numlnput. Text =除數(shù)不能為0;sp = 1;elsethis txt Input Te/t += result ToStringO; this .numlnput .Text = result .ToStringO;private void sub_Click(object sender, EventArgs e)/ 減法 max = 0;if (f
7、lag = 1 & sp = 0)numl = Convert ToDouble(this numlnput Text);this txt Input Text += num 1 ToStringO ; numinput .Text = ”;thistxtInput .Text +=op = 2;private void mul_Click(object sender, EventArgs e)乘法max = 0;if (flag = 1 & sp = 0)numl = Convert ToDouble(this numlnput Text);this txt Input Text += nx
8、im 1 ToStringO ;this .numlnput .Text =:thistxtInput .Text +=op = 3;private void divide_Click(object sender, EventArgs e) T除法max = 0;if (flag = 1 & sp = 0)numl = Convert ToDouble(this numlnput Text);this txt Input Text += num 1 ToStringO ;this .numlnput .Text =:thistxtInput .Text +=*;op = 4;private v
9、oid plus_Click(object sender, EventArgs e); AlHlij;max = 0;if (flag = 1 & sp = 0)numl = Convert ToDouble(this numlnput Text);this txt Input Text += num 1 ToStringO ;numlnput .Text =”;thistxtInput .Text +=十op = 1;J public double Mod (double x, double y)/取模運(yùn)算max = 0;int temp = ConvertToInt32(x / y);re
10、turn (x y * temp);private void power_Click(object sender, EventArgs e) 錦運(yùn)算max = 0;if (flag = 1 & sp = 0)numl = Convert ToDouble(numinput Text);this txt Input Text += nxim 1 ToStringO ;this numinput Text =:this txt Input .Text +=op = 5;Jprivate void recip_Click(object sender, EventArgs e), 倒數(shù)max = 0;
11、if (flag = 1 & sp = 0)numl = Convert ToDouble(this numlnput Text);double temp = 0;temp = 1 / numl:this txt Input .Text =1 + num 1 ToStringO +=;this nximlnput Text = temp ToStringO ;private void percent_Click(object sender, EventArgs e)max = 0;if (flag = 1 & sp = 0)double temp = ConvertToDouble(this.
12、numlnput.Text);/this txtInput Text += temp ToString0;/temp = temp / 100;/this numinput Text = temp ToStringO;/thistxtInput .Text +=numl = Convert ToDouble(this numlnput Text);this txt Input Text += num 1 ToStringO ;this .numlnput .Text =thistxtInput .Text 二 %op = 6;SendregionSregion 數(shù)字private void o
13、ne_Click(object sender, EventArgs e) 1 if (flag = 1 & sp = 0 & max = 0)if (thisnumlnput.Text = 0 )thisnumlnput .Text =;if (eq = 1)this numinput Text = 1; eq = 0;elsethisnumlnput .Text += 1;private void two_Click(object sender, EventArgs e) 2 if (flag = 1 & sp = 0 & max = 0)if (thisnumlnput.Text =0 )
14、thisnumlnput .Text =if (eq = 1)thisnumlnput .Text = 2; eq = 0;elsethisnuminput .Text += 2; /thistxtInput .Text += 2;private void three_Click(object sender, EventArgs e) 3if (flag = 1 & sp = 0 & max = 0)if (thisnuminput .Text = 0)thisnuminput .Text = ”;if (eq = 1)thisnumlnput .Text = 3;eq = 0;elsethi
15、snumInput .Text +=3;/thistxtInput .Text += 3;private void four_Click(object sender, EventArgs e) 1 if (flag = 1 & sp = 0 & max = 0)if (thisnuminput .Text = 0)thisnuminput .Text = ”;if (eq = 1)thisnumlnput .Text = 4;eq = 0;elsethisnuminput .Text 十=4;/ thistxtInput .Text -= 4;private void five_Click(o
16、bject sender, EventArgs e) 5 if (flag = 1 & sp = 0 & max = 0)if (thisnuminput .Text = 0)thisnumlnput .Text =”;if (eq = 1)thisnumlnput .Text = 5;eq = 0;elsethisnumlnput.Text = 5;/ thistxtInput .Text += 5;private void six_Click(object sender, EventArgs e). 6if (flag = 1 & sp = 0 & max = 0)if (thisnuml
17、nput.Text = 0”)thisnumlnput .Text =if (eq = 1)thisnumlnput .Text = 6;eq = 0;elsethisnuminput .Text += 6;this txt Input Te:rt += 6;private void seven_Click(object sender, EventArgs e)/. 7if (flag = 1 & sp = 0 & max = 0)if (thisnumlnput.Text = 0 )thisnumlnput .Text =if (eq = 1)thisnumlnput .Text = 7;e
18、q = 0;private void eightClick(object sender, EventArgs e) 8else thisnuminput .Text += 7;Uhistxtinput .Text -= 7;if (flag = 1 & sp = 0 & max = 0)if (thisnuminput .Text = 0)thisnuminput .Text =if (eq = 1)thisnuminput .Text = 8;eq = 0;elsethisnuminput .Text += 8;/thistxtInput .Text += S;private void ni
19、ght_Click(object sender, EventArgs e) . 9if (flag = 1 & sp = 0 & max = 0)if (thisnumlnput.Text = 0)thisnumlnput .Text = “;if (eq = 1)thisnuminput .Text = 9;eq = 0;elsethisnumInput .Text += 9;/thistxtInput .Text += 9;private void zero_Click(object sender, EventArgs e) 0if (flag = 1 & sp = 0 & max = 0
20、) if (thisnumlnput.Text = 0)thisnumlnput .Text =if (eq = 1)thisnumlnput .Text = 0;eq = 0;elsethisnuminput .Text += 0; thistxtInput .Text += 0;private void dian_Click(object sender, EventArgs e) /小數(shù)點(diǎn) if (flag = 1 & sp = 0 & max = 0)if (eq = 1)this numlnput .Text =eq = 0;elsethis numinput .Text *=/thi
21、stxtInputText +二Sendregionregion三角函數(shù)private void sin_Click(object sender, EventArgs e)/ sinif (flag = 1 & sp = 0)numl = Convert ToDouble(this numlnput Text); double temp = Math. PI * (numl / 180);thistxtInput.Text += sin( + numl +numl = MathSin(temp);this numinput Text = num 1 ToStringO ;this txt In
22、put Text += num 1 ToStringO ;private void cos_Click(object sender, EventArgs e) cosif (flag = 1 & sp = 0)numl = Convert ToDouble(this numlnput Text);double temp = Math. PI * (numl / 180);thistxtInput.Text += cos C + numl +numl = MathCos(temp);this.numlnput.Text = num 1 ToStringO ;private void tan_Cl
23、ick(object sender, EventArgs e)/ tanif (flag = 1 & sp = 0)numl = Convert ToDouble(this numlnput Text);double temp = Math. PI * (numl / 180);thistxtInput.Text += tan(* + numl + )二;numl = MathTan(temp);this nximlnput Text = num 1 ToStringO ;Sendregionregion 幫助private void JPiHiToolStripMenuItem_Click(
24、object sender, EventArgs e)MenuAbout about = new MeniaAbout ();about Show();private void change_Click(object sender, EventArgs e)max = 0;if (flag = l&sp = 0)numl = Convert ToDouble(this numlnput Text);private void 使用手冊(cè)ToolStripHenuIteni_Cl.ick(object sender, EventArgs e)numl = -numl;this nximlnput T
25、ext = num 1 ToStringO ;MenuUse use = new MenuUse();use. Show();Sendregionregion 皮膚private void KlToolStripMenuItem_Click(object sender, EventArgs e)skinEngine1SkinFile = ApplicationStartupPath + Calmnessssk;private void 2ToolStripMenuItem_Click(object sender, EventArgs e)skinEngine1SkinFile = ApplicationStartupPath + DeepCyanssk;private void Jti3ToolStripMenuItein_Click(object sender, EventArgs e)skinEngine1SkinFile = ApplicationStartupPath + Eighteenssk;private void /t;4ToolStripMenuItem_Click(object sender, EventArgs e)skinEngine1SkinFile = A
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度班組工人崗位調(diào)動(dòng)勞務(wù)合同范本3篇
- 二零二五年度二手房買賣定金及房屋維護(hù)責(zé)任合同3篇
- 2024年離婚指南:變化與準(zhǔn)備3篇
- 2023-2029年中國孕婦防輻射馬甲行業(yè)市場深度評(píng)估及投資戰(zhàn)略規(guī)劃報(bào)告
- 2024沙石廠員工勞動(dòng)合同及勞動(dòng)合同解除與終止規(guī)定3篇
- 2025年中國美容整容植入醫(yī)療器械行業(yè)市場調(diào)研分析及投資戰(zhàn)略咨詢報(bào)告
- 2025版采購合同中的價(jià)格及供應(yīng)商信息保密協(xié)議3篇
- 嘉澤新能:2022年度環(huán)境、社會(huì)及管治(ESG)報(bào)告
- 二零二五年度二手房傭金傭金收取標(biāo)準(zhǔn)與透明化承諾協(xié)議2篇
- 2025版租賃車輛租賃合同電子簽名服務(wù)合同2篇
- 礦業(yè)公司規(guī)章制度匯編
- 《高低壓配電室施工工藝標(biāo)準(zhǔn)》
- 2024年太陽能光伏組件高空清洗作業(yè)人員安全保障合同3篇
- 大學(xué)學(xué)業(yè)規(guī)劃講座
- 《國家課程建設(shè)》課件
- 浙江省衢州市2023-2024學(xué)年高一上學(xué)期1月期末數(shù)學(xué)試題 含解析
- 【課件】Unit+5+Fun+Clubs+Section+B+1a-2b課件人教版(2024)七年級(jí)英語上冊(cè)++
- 江蘇省南通市海門區(qū)2023-2024學(xué)年三年級(jí)上學(xué)期期末語文試題
- 靜脈輸液治療小組工作總結(jié)
- 總磷課件教學(xué)課件
-
評(píng)論
0/150
提交評(píng)論