




版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、楊柔楊柔YangRou付麗平付麗平FuLIPing劉計(jì)云劉計(jì)云LiuJiYun1 12 23 3姚婷姚婷YaoTing標(biāo)題1標(biāo)題2標(biāo)題3 計(jì)算器的代碼編程計(jì)算器的代碼編程計(jì)算器的功能介紹計(jì)算器的界面設(shè)計(jì)1 12 23 31 12 2付麗萍功能介紹楊柔界面設(shè)計(jì)姚婷劉計(jì)云代碼編程 引出一個(gè)數(shù)學(xué)類(lèi)庫(kù)頭文件#include math.h#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endif/預(yù)定義兩個(gè)常數(shù)變量PI和e#define PI 3.1415926#define e 2.71
2、8281828459/定義字符串類(lèi)型的兩個(gè)變量a1與a2,主要用于對(duì)兩次輸入的數(shù)據(jù)進(jìn)行緩存以便于進(jìn)行計(jì)算CString a1,a2;/一個(gè)整數(shù)變量m,用于在函數(shù)Onequal中進(jìn)行運(yùn)算時(shí)進(jìn)行運(yùn)算符的選擇int m=0;Set the icon for this dialog. The framework does this automaticallySet big iconSet small icon when the applications main window is not a dialog如果你添加一個(gè)盡量減少如果你添加一個(gè)盡量減少按鈕到您的對(duì)話框,你將需按鈕到您的對(duì)話框,你將需y代
3、碼繪制圖標(biāo)。代碼繪制圖標(biāo)。對(duì)對(duì)applicationsusing的的文檔文檔/視圖模型,這是自動(dòng)完成你的框架。視圖模型,這是自動(dòng)完成你的框架。The system calls this to obtain the cursor to display while the user dragsvoid CCalculatebDlg:OnPaint() if (IsIconic()CPaintDC dc(this); / device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);/
4、Center icon in client rectangleint cxIcon = GetSystemMetrics(SM_CXICON);Contentwelcome to use these PowerPoint templates, New Content design, 10 years experienceint cyIcon = GetSystemMetrics(SM_CYICON);CRect rect;GetClientRect(&rect);int x = (rect.Width() - cxIcon + 1) / 2;int y = (rect.Height()
5、 - cyIcon + 1) / 2;/ Draw the icondc.DrawIcon(x, y, m_hIcon);elseCDialog:OnPaint();通過(guò)該操作可以把計(jì)算器內(nèi)部通過(guò)通過(guò)該操作可以把計(jì)算器內(nèi)部通過(guò)a1、a2緩存的值以緩存的值以及界面顯示的值全部清空。及界面顯示的值全部清空。void CCalculatebDlg:Once() / TODO: Add your control notification handler code hereUpdateData();/m_lecture = ;a1 = ;a2 = ;UpdateData(FALSE);void CCal
6、culatebDlg:Ondel()/ TODO: Add your control notification handler code hereUpdateData();int length =m_lecture.GetLength();/通過(guò)調(diào)用內(nèi)部函數(shù)m_edit.GetLength()來(lái)獲取顯示其上的長(zhǎng)度并將值賦給變流量length,length-;/把length值減一m_lecture = m_lecture.Left(length)/從左側(cè)起獲取length位的數(shù)據(jù)交給顯示框顯示UpdateData(FALSE);Content/加減乘除和求余加減乘除和求余void CCalcu
7、latebDlg:Ona() UpdateData();a1=m_lecture;m_lecture+=+;m=1;UpdateData(FALSE); void CCalculatebDlg:Onb() / TODO: Add your control notification handler code here UpdateData();a1=m_lecture;m_lecture+=-;m=2;UpdateData(FALSE); void CCalculatebDlg:Oncot() / TODO: Add your control notification handler code
8、hereUpdateData();a1=m_lecture;double num1=atof(a1);double num2=cos(PI/180*num1)/sin(PI/180*num1);m_lecture.Format(_T(%lf), num2);UpdateData(FALSE);void CCalculatebDlg:Onc() / TODO: Add your control notification handler code hereUpdateData();a1=m_lecture;m_lecture+=*;m=3;UpdateData(FALSE)void CCalcul
9、atebDlg:Onarcsin() / TODO: Add your control notification handler code herea1=m_lecture;double num1=atof(a1);double num2= asin (num1)*(180/PI);m_lecture.Format(_T(%lf), num2);UpdateData(FALSE);void CCalculatebDlg:Onarccos() / TODO: Add your control notification handler code herea1=m_lecture;double nu
10、m1=atof(a1);double num2= acos (num1)*(180/PI);m_lecture.Format(_T(%lf), num2);UpdateData(FALSE);void CCalculatebDlg:Onarctan() / TODO: Add your control notification handler code herea1=m_lecture;double num1=atof(a1);double num2= atan (num1)*(180/PI);m_lecture.Format(_T(%lf), num2);UpdateData(FALSE);
11、1 12 23 32 23 3123首先,將輸入的值賦給編輯框,然后將a1轉(zhuǎn)換成雙精度的書(shū)num1231/首先把輸入的數(shù)據(jù)傳給r1,然后將r1由字符串型轉(zhuǎn)換成雙精度字符型num1/(First turn on the second input data to r1, then r1from the string type into double precision character type num1)/最后,三個(gè)或兩個(gè)num1相乘即可/x3運(yùn)算oid CCalculatebDlg:Onpow() / TODO: Add your control notification handler c
12、ode herea1=m_lecture;double num1=atof(a1);double num2= num1*num1;m_lecture.Format(_T(%lf), num2);UpdateData(FALSE);Contentvoid CCalculatebDlg:Ondaoshu() / TODO: Add your control notification handler code here a1=m_lecture;double num1=atof(a1); double num2= 1/num1 ; m_lecture.Format(_T(%lf), num2);Up
13、dateData(FALSE);Contentvoid CCalculatebDlg:Onjiecheng() / TODO: Add your control notification handler code hereUpdateData();a1=m_lecture;double n=atof(a1); doublej=1,num2=1; for(j=1;j=n;j+) num2=j*num2; m_lecture.Format(_T(%lf), num2);UpdateData(FALSE);Contentvoid CCalculatebDlg:Onsqrt() / TODO: Add your control notification handler code hereUpdateData
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 生態(tài)養(yǎng)殖基地承包合同
- 項(xiàng)目進(jìn)度追蹤與協(xié)同策劃方案
- 現(xiàn)代學(xué)徒制師徒協(xié)議
- 柑橘樹(shù)承包合同
- 食品安全檢測(cè)技術(shù)研究開(kāi)發(fā)合作協(xié)議
- 汽車(chē)租賃合同租賃車(chē)輛交接確認(rèn)書(shū)
- 投資借款合同書(shū)
- 共建聯(lián)合實(shí)驗(yàn)室合作合同協(xié)議書(shū)范本模板5篇
- 活動(dòng)一《自己種菜樂(lè)趣多》(教學(xué)設(shè)計(jì))-2023-2024學(xué)年四年級(jí)上冊(cè)綜合實(shí)踐活動(dòng)滬科黔科版
- Unit4 I have a ball(教學(xué)設(shè)計(jì))-2024-2025學(xué)年人教精通版英語(yǔ)三年級(jí)上冊(cè)
- 七年級(jí)下冊(cè)心理健康教育教學(xué)設(shè)計(jì)
- 食堂清洗及消毒制度
- 服裝質(zhì)量管理制度
- 稀土材料技術(shù)基礎(chǔ)知識(shí)單選題100道及答案解析
- 自然辯證法概論:第四章-馬克思主義科學(xué)技術(shù)社會(huì)論
- 建筑工程質(zhì)量管理培訓(xùn)
- GB/T 17395-2024鋼管尺寸、外形、重量及允許偏差
- 基礎(chǔ)、主體、裝飾裝修階段檢驗(yàn)、驗(yàn)收計(jì)劃表-
- 城市地下管網(wǎng)建設(shè)工程投標(biāo)響應(yīng)文件
- 胎兒附屬物課件
- 七年級(jí)信息技術(shù)上冊(cè) 第13課時(shí) 文件管理教案 科教版
評(píng)論
0/150
提交評(píng)論