




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
實驗3分支和循環(huán)程序設(shè)計實驗?zāi)康模菏炀氄莆辗种Ш脱h(huán)結(jié)構(gòu)的設(shè)計方法,熟悉跳轉(zhuǎn)和循環(huán)指令的使用方法。實驗要求:按照要求編寫程序,調(diào)試運行。實驗內(nèi)容:1、編寫程序?qū)崿F(xiàn)下面的算法:ifthenlowerCount+1;elseif(ch≥’A’)and(ch≤’Z’)thenupperCount+1elseotherCount+1;endifendif其中ch調(diào)用ReadChar輸入,lowerCount,upperCount和otherCount的值用WriteUDecByte顯示。2、編寫程序從鍵盤輸入一系列有符號數(shù),找出其中的最大數(shù)和最小數(shù),顯示運行結(jié)果。建議算法如下:顯示“Firstnumber?”;調(diào)用ReadSDecDword輸入雙字有符號數(shù);minimum:=number;maximum:=number;while(顯示“Anothernumber?(YorN)”)loopif(輸入Y)then調(diào)用ReadSDecDword輸入雙字有符號數(shù);if(number<minimum)thenminimum:=number;endifif(number>maximum)thenmaximum:=number;endifendwhile3-6題中任選一題:3、編寫程序?qū)AX的內(nèi)容轉(zhuǎn)換為二進制字符串4、編寫程序?qū)AX的內(nèi)容轉(zhuǎn)換為十六進制字符串5、編寫程序?qū)AX的內(nèi)容轉(zhuǎn)換為無符號十進制字符串6、編寫程序?qū)AX的內(nèi)容轉(zhuǎn)換為有符號十進制字符串,負(fù)數(shù)字符串以“-“引導(dǎo)。7-10題中任選一題:7、編寫程序?qū)⒍M制字符串表示的數(shù)據(jù)存入EAX寄存器8、編寫程序?qū)⑹M制字符串表示的數(shù)據(jù)存入EAX寄存器9、編寫程序?qū)⑹M制字符串表示的無符號數(shù)據(jù)存入EAX寄存器10、編寫程序?qū)⑹M制字符串表示的有符號數(shù)據(jù)存入EAX寄存器實驗步驟及程序:1、編寫程序?qū)崿F(xiàn)下面的算法:.386.modelflat,stdcall.datalowerCountword0upperCountword0otherCountword0chabyte?promortbyte"Pleaseinputthelengthofstring:",0promort1byte"Pleaseinputastring:",0dh,0ah,0promort2byte"lowerCount=",0promort3byte"upperCount=",0promort4byte"otherCount=",0textbyte50dup(?).codestart:WriteStringPromortReadSDecDwordecxWriteStringpromort1ReadStringtextmovebx,0again:moval,byteptrtext[ebx]cmpal,'A'jbotcmpal,'Z'jnaupcmpal,'a'jbotcmpal,'z'jnaloot:incotherCountjmpnextup:incupperCountjmpnextlo:inclowerCountnext:incebxloopagainWriteStringpromort2WriteUDecwordlowerCountWriteCrlfWriteStringpromort3WriteUDecwordupperCountWriteCrlfWriteStringpromort4WriteUDecwordotherCountWriteCrlfretendstart2、編寫程序從鍵盤輸入一系列有符號數(shù),找出其中的最大數(shù)和最小數(shù),顯示運行結(jié)果。3.386.modelflat,stdcall.datapromotbyte"Firstnumber?:",0permot1byte"Anothernumber(YorN)?",0permot2byte"Anothernumber:",0permot3byte"mininum=",0permot4byte"maxinum=",0minnumdword?maxnumdword?.codestart:WriteStringPromotReadSDecDwordeaxmovminnum,eaxmovmaxnum,eaxagain:WriteStringpermot1ReadCharalsubal,'N'cmpal,0jzdonexoreax,eaxWriteStringpermot2ReadSDecDwordeaxcmpeax,minnumjlmincmpeax,maxnumjgmaxmin:movminnum,eaxjmpagainmax:movmaxnum,eaxjmpagaindone:WriteStringpermot3WriteSDecDwordminnumWriteCrlfWriteStringpermot4WriteSDecDwordmaxnumWriteCrlfretendstart3、編寫程序?qū)AX的內(nèi)容轉(zhuǎn)換為二進制字符串.386.modelflat,stdcall.stack.datapromortbyte"Pleaseinputnum:",0BinStrbyte32dup(?),0.codestart:WriteStringpromortReadSDecDwordeaxmovecx,32movebx,offsetBinStragain:shleax,1jcnext1movbyteptr[ebx],'0'jmpnextnext1:movbyteptr[ebx],'1'next:incebxdececxjnzagainWriteStringBinStrretendstart8、編寫程序?qū)⑹M制字符串表示的數(shù)據(jù)存入EAX寄存器.386.modelflat,stdcall.datapromortbyte"Plearseinputthestring(endwith@):",0dh,0ah,0promort1byte"ERRORINPUT!",0arraybyte35dup(?).codestart:WriteStringpromortmovecx,0xoreax,eaxReadStringarrayagain:xorebx,ebxmovbl,array[ecx]cmpbl,'@';判斷字符串是否結(jié)束jzendincmpbl,'0';判斷輸入的字符是否為‘0’-‘9’jberror0cmpbl,'9'jbedone1subbl,'A';判斷輸入的字符是否為A-Fcmpbl,0jberror0cmpbl,6jaerror0roleax,4;是A-F,則將字符轉(zhuǎn)化為10-15addebx,10addeax,ebxjmpn2done1:roleax,4andebx,0fhaddeax,ebxn2:incecxjmpagainendin:WriteCrlfWriteUDecDwordeaxjmpdoneerror0:WriteStringpromort1done:retendstartHYPERLINK"/retype/zoom/f11a
溫馨提示
- 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)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 開辦幼兒園住宅樓租賃合同范本
- 美容服務(wù)協(xié)議書范本
- 房屋租賃獨家代理合同范本
- 七年級語文上冊三單元整體教學(xué)設(shè)計
- 《第二單元 漢字輸入:4 拼音輸入法》教學(xué)設(shè)計-2023-2024學(xué)年浙江攝影版(2023)三年級下冊
- 道路施工合同范本簡單3
- 籃球半場人盯人防守 教學(xué)設(shè)計-2023-2024學(xué)年高一上學(xué)期體育與健康人教版必修第一冊
- Unit 2 Great people Reading 教學(xué)設(shè)計 2024-2025學(xué)年牛津譯林版九年級英語下冊
- 第七單元《三位數(shù)除以兩位數(shù)的口算和估算》(教學(xué)設(shè)計)-2024-2025學(xué)年數(shù)學(xué)西師大版四年級上冊
- 籃球:傳切配合及其戰(zhàn)術(shù)運用 教學(xué)設(shè)計-2023-2024學(xué)年高一上學(xué)期體育與健康人教版必修第一冊
- 應(yīng)收帳款質(zhì)押擔(dān)保合同
- 2025年度建筑垃圾運輸與再生資源回收一體化合同樣本
- 2025年臨床醫(yī)師定期考核必考復(fù)習(xí)題庫及答案(900題)
- JTG5120-2021公路橋涵養(yǎng)護規(guī)范
- 2024年廣東省公務(wù)員考試《行測》真題及答案解析
- 河南省信陽市固始縣2023-2024學(xué)年四年級下學(xué)期期末數(shù)學(xué)試題
- 王淑玲《做最好的自己》讀書分享
- 主要工業(yè)產(chǎn)品統(tǒng)計指南
- 新蘇教版科學(xué)六年級下冊全冊教案(含反思)
- 實習(xí)鑒定表1頁
- 鉚工基礎(chǔ)知識培訓(xùn)ppt課件
評論
0/150
提交評論