dap an 13
Include C:\TASM\INCLUDE\Lib1.asm
.Model small
.Stack 100h
.Data
M1 db 13,10,'>>Hay vao thanh phan so luong cua day : $'
M2 db 13,10,'a[$'
M3 db '] = $'
M4 db 13,10,'So luong thanh phan cua day < 100 la : $'
M5 db 13,10,'Tiep tuc chuong trinh ( C/K ) ? $'
M6 db 13,10,'Chuc nang khong ton tai . Moi chon lai !$'
Array dw 100 dup(?)
.Code
Main :
mov ax,@data
mov ds,ax
;clrscr
HienString M1
call Vao_So_N
cmp ax,1
jb Hoi
mov dx,ax ; dx = so luong
xor si,si ; si = STT
mov cx,ax
lea bx , Array
Nhap:
HienString M2
mov ax,si
call Hien_So_N
HienString M3
call Vao_So_N
mov [bx],ax
inc si
add bx,2
loop Nhap
HienString M4
lea bx , Array
mov cx,dx
xor ax,ax
XuLy:
mov dx,[bx]
cmp dx,100
jge LonHon100
inc ax
LonHon100:
add bx,2
loop XuLy
call Hien_So_N
Hoi :
HienString M5
mov ah,1
int 21h
or al,20h
cmp al,'c'
jz Nhay
cmp al,'k'
jz Finish
HienString M6
jmp Hoi
Nhay:
jmp Main
Finish:
mov ah,4ch
int 21h
Include Lib2.asm
End Main
1a:
.Model small
.Data
Extrn _Array : DWORD, _n : WORD
.Code
Public @NhoHon100$qv
@NhoHon100$qv PROC
mov bx,OFFSET _Array
mov ax,SEG _Array
mov es,ax
mov cx,_n
xor ax,ax
XuLy:
mov dx,es:[bx]
cmp dx,100
jge LonHon100
inc ax
LonHon100 :
add bx,2
loop XuLy
ret
@NhoHon100$qv Endp
End
1c:
#include<iostream.h>
#include<conio.h>
int n;
int Array[100];
extern int NhoHon100();
void main(void)
{
Start :
clrscr();
int i;
cout<<">>Hay vao thanh phan so luong cua day : ";
cin>>n;
for(i=0;i<n;i++)
{
cout<<"a["<<i<<"] = ";
cin>>Array[i];
}
cout<<"So luong cac thanh phan < 100 cua day so la : "<<NhoHon100();
cout<<"
Tiep tuc chuong trinh (C/K) ? ";
char answer = getch();
if(answer=='c'|| answer=='C')
goto Start;
}
Bạn đang đọc truyện trên: Truyen247.Pro