計算機原理程序設計報告_第1頁
計算機原理程序設計報告_第2頁
計算機原理程序設計報告_第3頁
計算機原理程序設計報告_第4頁
計算機原理程序設計報告_第5頁
已閱讀5頁,還剩4頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、計算機原理程序設計報告09070206來小嫡第一題1 題目要求:編寫程序,鍵入學生成績(百分制幾 按a、b、c、d顯示疫屛幕上。2.編程思路:t先從鍵盤連續(xù)接收3次數(shù)字,并把字符的asc碼轉(zhuǎn)換成真正的數(shù)字, 第一次接收的數(shù)字為百住,需乘100,第二次接收的為十伐,需乘10, 并與創(chuàng)才計算的百住相加,第三次接受的是個住,與計算好的百住十 住相加得到最終數(shù)字。把數(shù)字和85,75,60相比較,得出分數(shù)等級。4.源程序data segmentdat1db'輸入成績(不足 3住教前補0,如80輸入 080j:dat2 db *分數(shù)等級:t$dat3 db,輸入錯娛data endsstack1

2、segment parastackdw 30h dup(o)stack1 endscode segmentassumecs:code,ds:datastart: mov ax.datamov ds,axmov dx.offset dat1mov ah,09hint21hmov ah,01hint21hsub al,o;mov cljoomulclmov cx,axmov ah,01hint21hsub alv5輸出屛幕扳圖mov bljomulblmov bx,axadd bx,cxmov ah,01h1nt21hsub al,omov ah,0add bx,axcmp bxjoomov dl

3、oahmov ah,21nt21hmov dxqffset dat3mov ah,09hint21hja exitmov dloahmov ah,21nt21hmov dxqffsetmov ah,09h1nt21hmov dloahmov ah,21nt21hcmp bx,60jb failja papa : cmp bx,75jb passja gogo :cmp bx,85jbgoodja excellentexcellent: mov dl/a1movah,02hint21hjmp exitgood:mov dl,bmovah,02hint21hjmp exitpass:mov dl/

4、cmovah,02hint21hjmp exitfail:mov dl,dmovah,02hint21hjmp exitexit:movah,4chint21hcode endsend startinput score:101 errorpress an9 key to continue第二題1 題目要求:編寫程序,求出100以內(nèi)既能彼2整除又能彼3整除的數(shù),并顯示 在屛幕上。2 編程思路:找到2和3的最小公僖數(shù)6,用100除以6,比較余數(shù),為0說朗能 整除,顯示輸出。再將100減1,繼續(xù)除以6尋找可彼整除的數(shù)字并 輸出,一直循環(huán),丘到100已經(jīng)減到1。3 流程圖:開始顯示提示信息r將100存

5、入bx6存入num將bx里 以6,比除數(shù) 數(shù)余 的較顯示輸出該n數(shù)(商)n*被除數(shù)減1被除數(shù)減1結(jié)束4.源程序data segmenttishi dbthenumber can be divided by2 and3:t$'num db 100 dup(?)data endscode segmentassumecs:code,ds:datastart:mov ax,datamov ds,axmov dx.offset tishimov ah,09hint21hmov dloahmov ah,2int21hmov bxjoomov num,6xunhuan:mov ax,bxdiv nu

6、mcmp ah,0jz showdecbxcmp bxjjnzxunhuanjmp exitshow:mov ax,bxmov cljodiv clmov dh,ahmov dualcmp al,0jz show1add dl,30hmov ah,2int21hshow1:mov dl,dhadd dl30hmov ah ,2int21hmov dl20hmov ah ,2int21hdecbxcmp bxjjnzxunhuanjmp exitexit:mov ah,4chint21hcode endsend start5輸出屛幕扳圖第三題1 題目要求:編寫子程序,分別計算100以內(nèi)所有奇數(shù)之

7、和與所有偶數(shù)之和,并顯 示在屛幕上。2 編程思路: 設置兩個計數(shù)器,一奇一偶,為別請零。將100除以2,余數(shù)為1,則把 商與奇數(shù)計數(shù)器的值相加;余數(shù)為0,則把商與偶數(shù)計數(shù)器的值相加, 接下來波除數(shù)100自減一后再除以2,看余數(shù)的值不同于不同的計數(shù) 器相加。一直循環(huán),直到彼除數(shù)100減至io調(diào)用十進制輸出因數(shù), 在提示語輸出后分別輸出100以內(nèi)所有奇數(shù)之和與所有偶數(shù)之和.3 流程圖:*脛 :4 源程序data segmenttishi1 db 'the sum ofodd:?*tishi2 db the sum ofeven:t$'num db 100 dup(?) no zer

8、o db 0data endscode segmentassumecs:code,ds:datastart:mov ax,datamov ds,axxor sisimov bp,s1mov bx, 100mov num,2xunhuan:mov ax,bxdiv numcmp ah,0jnzqishuoushu:addbp,bxdecbxcmp bxjjaxunhuanq1shu:addslbxdecbxcmp bxjjaxunhuancall decdivmov dxqffset t1shi2emp nozero. 0mov ah,09hjne outdexitint21hmov dl3oh

9、mov bx,bpmov ah. 2call outdint 21hmov dl odhoutdexit:mov ah, 2pop exint21hretmov dl oahdecdiv procmov ah, 2mov ax. bxint21hmov dx, 0mov dxqffset tishi1 :div exmov ah,09hmov bx, dxint21hmov dl almov bx,siemp dl. 0cal! outdjne dispdigitexit:emp nozero. 0mov ah,4chjne dispdigitint21hjmp decdivexitoutd procdispdigit:push exmov no zero, 1mov nozero.oadd dl, 30hmov ex, 10000mov ah. 2cal! d

溫馨提示

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

評論

0/150

提交評論