![VC++計(jì)算器課程設(shè)計(jì)報(bào)告_第1頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2021-12/5/0cc10698-7f7f-4a98-97bf-6e47f1648509/0cc10698-7f7f-4a98-97bf-6e47f16485091.gif)
![VC++計(jì)算器課程設(shè)計(jì)報(bào)告_第2頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2021-12/5/0cc10698-7f7f-4a98-97bf-6e47f1648509/0cc10698-7f7f-4a98-97bf-6e47f16485092.gif)
![VC++計(jì)算器課程設(shè)計(jì)報(bào)告_第3頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2021-12/5/0cc10698-7f7f-4a98-97bf-6e47f1648509/0cc10698-7f7f-4a98-97bf-6e47f16485093.gif)
![VC++計(jì)算器課程設(shè)計(jì)報(bào)告_第4頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2021-12/5/0cc10698-7f7f-4a98-97bf-6e47f1648509/0cc10698-7f7f-4a98-97bf-6e47f16485094.gif)
![VC++計(jì)算器課程設(shè)計(jì)報(bào)告_第5頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2021-12/5/0cc10698-7f7f-4a98-97bf-6e47f1648509/0cc10698-7f7f-4a98-97bf-6e47f16485095.gif)
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、22VC+計(jì)算器課程設(shè)計(jì)報(bào)告1.作品名稱:計(jì)算器2.本次課程設(shè)計(jì)的目的 在程序設(shè)計(jì)中,通過(guò)設(shè)計(jì)、編制、調(diào)試一個(gè)模擬計(jì)算器的程序,加深對(duì)語(yǔ)法及語(yǔ)義分析原理的理解,并 實(shí)現(xiàn)對(duì)命令語(yǔ)句的靈活應(yīng)用。3.主要功能實(shí)現(xiàn)計(jì)算器的功能。用戶根據(jù)程序提示,輸入數(shù)字或字符,選擇要進(jìn)行的運(yùn)算,可以進(jìn)行正弦、余弦、正切、開(kāi)方、對(duì)數(shù)、加、減、乘、除、華氏溫度與攝氏度之間的換算以及平方根的運(yùn)算。4.代碼#include <process.h>#include<time.h>#define MAX 100#include <iostream.h>#include <conio.h&
2、gt;#include <stdlib.h>#include <math.h>double number1,number2,answer,number3,num10000; int n,k=1;char input,val; class oopcalc private:double x,y; double fartocel(double number1); double celtofar(double number1); double sqroot(double number1);void calcsqr();void calccos();void calctan();
3、void calcsin();void calclog();public:double getX()return x;double getY()return y;double set()x=number1;y=number2;double calcadd(double number1,double number2); double calcsub(double number1,double number2); double calcdiv(double number1,double number2); double calcmult(double number1,double number2)
4、; void calcfartocel();void calcceltofar();void calcsroot();void exitprog();void menu();void caculate(); void test();void badinput(); ;void oopcalc:calcsin()cout<<"The Sin Functionn"cout<<"Enter a number:"cin>>number1;answer=sin(number1);cout<<"The sin
5、 of "<<number1<<" is "<<answer<<endl;cout<<"Press any key to continuen"getch();menu();void oopcalc:calccos()cout<<"The Cos Functionn"cout<<"Enter a number:"cin>>number1;answer=cos(number1);cout<<"
6、The cos of "<<number1<<" is "<<answer<<endl;cout<<"Press any key to continuen"getch();menu();void oopcalc:calctan()cout<<"The Tan Functionn"cout<<"Enter a number:"cin>>number1;answer=tan(number1);cout<<
7、;"The tan of "<<number1<<" is "<<answer<<endl;cout<<"Press any key to continuen"getch();menu();void oopcalc:calcsqr()cout<<"The sqr Functionn"cout<<"Enter a number:"cin>>number1;answer=(number1*number1)
8、;cout<<"The sqr of "<<number1<<" is "<<answer<<endl;cout<<"Press any key to continuen"getch();menu();void oopcalc:calclog()cout<<"The Log Functionn"cout<<"Enter a number:"cin>>number1;if(number1&l
9、t;=0) cout<<"Bad input!n"cout<<"Press any key to continuen"getch();menu();elseanswer=log(number1);cout<<"The log of "<<number1<<" is "<<answer<<endl;cout<<"Press any key to continuen"getch();menu();doub
10、le oopcalc:calcadd(double number1,double number2) answer=number1+number2;return(answer);double oopcalc:calcsub(double number1,double number2) answer = number1-number2;return(answer);double oopcalc:calcdiv(double number1,double number2) if(number2=0)getch();menu();elseanswer = number1/number2;return(
11、answer);double oopcalc:calcmult(double number1,double number2) answer = number1*number2;return(answer);void oopcalc:calcfartocel()cout << "The Farenheit to Celsius Functionn"cout << "Enter a tempature in Farenheit: "cin >> number1;answer =(number1 - 32) * 5) / 9
12、;cout << "The tempature in Celsius is " << answer << endl;cout << "Press any key to continuen"getch();menu();void oopcalc:calcceltofar()cout << "The Celsius to Farenheit Functionn"cout << "Enter a tempature in Celsius: "cin
13、>> number1;answer =number1 * 9 / 5 + 32;cout << "The tempature in Farenheit is " << answer << endl;cout << "Press any key to continuen"getch();menu();void oopcalc:calcsroot()cout << "The Square Root Functionn"cout << "First
14、 number: "cin >> number1;if(number1<0) cout<<"your enter is incorrect,please enter a new numbern"getch();menu();elseanswer = sqrt(number1);cout << "The square root of " << number1 << " is " << answer << endl;cout <<
15、; "Press any key to continuen"getch();menu();void oopcalc:exitprog()exit(-1);void oopcalc:menu()oopcalc a;system("cls"); cout << "=MENU=n"cout <<"s:選擇s進(jìn)行正弦運(yùn)算n"cout <<"c:選擇c進(jìn)行余弦運(yùn)算n"cout <<"t:選擇t進(jìn)行正切運(yùn)算n"cout <<&q
16、uot;g:選擇g進(jìn)行對(duì)數(shù)運(yùn)算n"cout <<"n:選擇n進(jìn)行求平方運(yùn)算n"cout << "1: 選擇1進(jìn)行混合運(yùn)算n"cout << "2: 選擇2進(jìn)行華氏溫度轉(zhuǎn)化為攝氏溫度的運(yùn)算n"cout << "3: 選擇3進(jìn)行攝氏溫度轉(zhuǎn)化為華氏溫度的運(yùn)算n"cout << "4: 選擇4進(jìn)行求平方根運(yùn)算n"cout << "5: 選擇5進(jìn)行測(cè)試n"cout << "6:選擇6
17、退出運(yùn)算n" cout << "請(qǐng)選擇: "cin >> input;cout << "=n"switch (input)case 's':case 'S':a.calcsin();break;case 'c': case 'C': a.calccos();break;case 't':case 'T': a.calctan();break;case 'g':case 'G':a.c
18、alclog();break;case 'n':case 'N':a.calcsqr();break;case '1':a.caculate();break;case '2':a.calcfartocel();break;case '3':a.calcceltofar();break;case '4':a.calcsroot();break;case '5': a.test();break;case '6':a.exitprog();break;default :a.
19、badinput();void oopcalc:caculate() oopcalc a;cout<<"The Multifunction(混合四則運(yùn)算)n"for(int n=1;n+)cout<<"Number"<<n<<"(Enter 0 to end entering):"cin>>numnif(numn=0)cout<<"Press any key to continuen"getch();menu();switch(k)case 1
20、:if(n=1)answer=num1;break;else answer=a.calcadd(answer,numn); cout<<"The answer is "<<answer<<endl;break;case 2:if(n=1)answer=num1;break;else answer=a.calcsub(answer,numn);cout<<"The answer is "<<answer<<endl;break;case 3:if(n=1)answer=num1;bre
21、ak;else answer=a.calcmult(answer,numn);cout<<"The answer is "<<answer<<endl;break;case 4:if(n=1)answer=num1;break;else answer=a.calcdiv(answer,numn);cout<<"The answer is "<<answer<<endl;break;label1:cout<<"Please choose the function
22、you want(+ or - or * or /):n"cin>>val;switch(val)case'+':k=1;break;case'-':k=2;break;case'*':k=3;break;case'/':k=4;break;default:cout<<"Bad input!n"goto label1;void oopcalc:test()cout<<"The Test Functionn"int s;float p;s=rand
23、()%4+1;srand ( time (NULL) );number1=rand()%MAX+1;number2=rand()%MAX+1;switch(s)case 1:cout<<number1<<'+'<<number2<<'='answer=calcadd(number1,number2);break;case 2:cout<<number1<<'-'<<number2<<'='answer=calcsub(number1,number2);break;case 3:cout<<number1<<'/'<<number2<<'='answer=calcdiv(number1,number2);break;case 4:cout&
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 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ì)用戶上傳內(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 七年級(jí)下冊(cè)《不等式的性質(zhì)》課件與練習(xí)
- 2025年電子金融相關(guān)設(shè)備合作協(xié)議書(shū)
- 電子文檔訪問(wèn)權(quán)限管理策略
- 2025年機(jī)房溫控節(jié)能項(xiàng)目建議書(shū)
- 通信信息保密協(xié)議
- 2025年玩具加工設(shè)備項(xiàng)目發(fā)展計(jì)劃
- 電商倉(cāng)庫(kù)運(yùn)作流程
- 5-1-4-Bipiperidin-1-yl-2-2-4-dimethylphenylsulfonamido-benzoic-acid-dihydrochloride-生命科學(xué)試劑-MCE
- 2025年工業(yè)用橡膠制品:膠管項(xiàng)目合作計(jì)劃書(shū)
- 工作進(jìn)度管理計(jì)劃書(shū)
- 初三數(shù)學(xué)一元二次方程應(yīng)用題附答案
- 教職工安全管理培訓(xùn)
- 2025年湖南中醫(yī)藥高等專(zhuān)科學(xué)校高職單招職業(yè)技能測(cè)試近5年??及鎱⒖碱}庫(kù)含答案解析
- 云南省曲靖市羅平縣2024-2025學(xué)年高二上學(xué)期期末地理試題( 含答案)
- 【歷史】金與南宋對(duì)峙課件-2024-2025學(xué)年統(tǒng)編版七年級(jí)歷史下冊(cè)
- 2025年春新人教PEP版英語(yǔ)三年級(jí)下冊(cè)課件 Unit 1 Part C 第8課時(shí) Reading time
- 中國(guó)糖尿病防治指南(2024版)要點(diǎn)解讀
- Unit 1 Nice boys and girls【知識(shí)精研】-一年級(jí)英語(yǔ)下學(xué)期(人教PEP版一起)
- 《口腔科學(xué)緒論》課件
- 《消防檢查指導(dǎo)手冊(cè)》(2024版)
- 2024年萍鄉(xiāng)衛(wèi)生職業(yè)學(xué)院?jiǎn)握新殬I(yè)技能測(cè)試題庫(kù)標(biāo)準(zhǔn)卷
評(píng)論
0/150
提交評(píng)論