C#計算器 實驗報告_第1頁
C#計算器 實驗報告_第2頁
C#計算器 實驗報告_第3頁
C#計算器 實驗報告_第4頁
C#計算器 實驗報告_第5頁
已閱讀5頁,還剩10頁未讀 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

楊在工瑋為、支@腮代攵芋院FujianUniv^hyo*Ttchtio^srGuomaiInformationCollege《c#》程序報告專業(yè): 軟件工程班級: 1201班學(xué)號: 姓名: 指導(dǎo)教師: 完成日期:2014年09月20日實驗1C#面向?qū)ο蟆緦嶒災(zāi)康摹坷斫獠⒄莆誄#面向?qū)ο笾蟹椒ǖ膮?shù)類型;理解并掌握C#語言中基于委托和事件的自動響應(yīng)機(jī)制?!緦嶒灜h(huán)境】Windows2003+VisualStudio2005(或更高版本)【實驗內(nèi)容】1.計算器【實驗結(jié)果】單擊“1”“+”“6”單擊“=”

叫計算器單擊“*”和“7”單擊和“9”咱計算器再單擊“/”和”5”單擊”=叫計算器單擊“C”單擊“4”“5”“%”“+”咱計算器單擊“5”“1/x”叫計算器■丄■■丄■單擊“6”“X2”單擊“CE”明計算器Q計算器單擊“一”叫計算器單擊“V”計算器單擊“2”磅計算器單擊□e計算器【實驗核心代碼】usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespaceWindowsFormsApplication1{publicpartialclassForm1:Form{publicForm1(){InitializeComponent();textBox1.Text="";}privateboolflag=false;privatevoidbutton1_Click(objectsender,EventArgse){if(textBoxl.Text.EndsWith("")&&textBoxl.Text.Length〉1)textBox1.Text=textBox1.Text.Substring(0,textBox1.Text.Length-3);elsetextBox1.Text=textBox1.Text.Substring(0,textBox1.Text.Length-1);}privatevoidbutton2_Click(objectsender,EventArgse){unaryoperators(2);}privatevoidbutton3_Click(objectsender,EventArgse){textBox1.Text="";flag=false;}EventArgse)privatevoidbutton4_Click(objectEventArgse)unaryoperators(4);}privatevoidbutton5_Click(objectsender,EventArgse){unaryoperators(5);}privatevoidbutton6_Click(objectsender,EventArgse){number(sender);}privatevoidbutton7_Click(objectsender,EventArgse){number(sender);}privatevoidbutton8_Click(objectsender,EventArgse)number(sender);}privatevoidbutton10_Click(objectsender,EventArgse){binocularoperators(sender);privatevoidbutton9_Click(objectsender,EventArgse){textBox1.Text=textBox1.Text.Substring(0,textBox1.Text.LastIndexOf(""));textBox1.Text+="0";}privatevoidbutton11_Click(objectsender,EventArgse){number(sender);}privatevoidbutton12_Click(objectsender,EventArgse){number(sender);}privatevoidbutton13_Click(objectsender,EventArgse){number(sender);}privatevoidbutton14_Click(objectsender,EventArgse){binocularoperators(sender);}privatevoidbutton15_Click(objectsender,EventArgse){unaryoperators(15);}privatevoidbutton16_Click(objectsender,EventArgse){number(sender);}privatevoidbutton17_Click(objectsender,EventArgse){number(sender);}privatevoidbutton18_Click(objectsender,EventArgse){number(sender);privatevoidbutton19_Click(objectsender,EventArgse){binocularoperators(sender);}privatevoidbutton20_Click(objectsender,EventArgse){Buttonbtn=(Button)sender;jscript();}privatevoidbutton21_Click(objectsender,EventArgse){number(sender);}privatevoidbutton22_Click(objectsender,EventArgse){number(sender);}privatevoidbutton23_Click(objectsender,EventArgse){binocularoperators(sender);}privatevoidnumber(objectsender){if(textBox1.Text.EndsWith("0"))textBox1.Text=""+textBox1.Text.Substring(0,textBox1.Text.Length-1);if(flag){flag=false;textBox1.Text="";Buttonbtn=(Button)sender;textBox1.Text+=btn.Text;}else{Buttonbtn=(Button)sender;textBox1.Text+=btn.Text;

}privatevoidbinocularoperators(objectsender){Buttonbtn=(Button)sender;if(!flag)jscript();textBox1.Text=textBox1.Text+""+btn.Text+"";flag=false;}privatevoidunaryoperators(inti){stringtemp=textBox1.Text.Substring(textBox1.Text.LastIndexOf(""));textBox1.Text=textBox1.Text.Substring(0,textBox1.Text.LastIndexOf(""));doubletempd=0;switch(i){case15:tempd=1/Convert.ToDouble(temp);break;case2:tempd=Convert.ToDouble(temp)/100;break;break;case4:tempd=tempd=Convert.ToDouble(temp)*Convertbreak;case5:tempd=tempd=Math.Sqrt(Convert.ToDouble(temp));break;}textBox1.Tex

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論