de 3 asm

Include C:\TASM\INCLUDE\Lib1.asm

.Model small

.Stack 100h

.Data

S1 db 13,10,'Hay vao n : $'

S2 db 13,10,'Giai thua cua $'

S3 db ' la : $'

S4 db 13,10,'Gia tri bieu thuc la : $'

S5 db 13,10,'Tiep tuc chuong trinh : ( C/K ) $'

DauCham db '.$'

.Code

Main :

mov ax,@data

mov ds,ax

;clrscr

HienString S1

call Vao_So_N

HienString S2

call Hien_So_N

HienString S3

mov cx,ax

mov bx,ax ; dx=n

mov ax,1

cmp cx,2

jb Bang1

Khac1 :

mul cx

loop Khac1

Bang1 :

call Hien_So_N

HienString S4

inc bx

div bx

call Hien_So_N

and dx,dx

jz Finish

HienString DauCham

mov cx,2

mov si,10

ThapPhan :

mov ax,dx

mul si

div bx

call Hien_So_N

and dx,dx

jz Finish

loop ThapPhan

Finish :

HienString S5

mov ah,1

int 21h

or al,20h

cmp al,'c'

jne Exit

jmp Main

Exit :

mov ah,4ch

int 21h

Include C:\TASM\INCLUDE\Lib2.asm

End Main

2a:

.Model small

.Data

Extrn _Array:DWORD,_n:WORD

.Code

Public @Min$qv

@Min$qv PROC

mov bx,OFFSET _Array

mov ax,SEG _Array

mov es,ax

mov cx,_n

mov ax,es:[bx]

dec cx

XuLy:

add bx,2

cmp ax,es:[bx]

jng NhoHon

mov ax,es:[bx]

NhoHon:

loop XuLy

ret

@Min$qv Endp

End

2c:

//Chua hien phan day so vua vao

#include<iostream.h>

#include<conio.h>

int n;

int Array[100];

extern int Min();

void main(void)

{

PS :

clrscr();

char answer;

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<<"Gia tri be nhat cua day so nguyen la : "<<Min();

cout<<"

Tiep tuc chuong trinh (C/K) ? ";

answer = getch();

if(answer=='c')

goto PS;

}

Bạn đang đọc truyện trên: AzTruyen.Top

Tags: #asm