dap an 12 asm

Include C:\TASM\INCLUDE\Lib1.asm

.Model small

.Stack 100h

.Data

Title1 db '| CHUONG TRINH |$'

Title2 db 13,10,'| TINH TRUNG BINH CONG 3 SO NGUYEN |$'

Title3 db 13,10,'------------------------------------$'

M1 db 13,10,'Nhap so thu 1 : $'

M2 db 13,10,'Nhap so thu 2 : $'

M3 db 13,10,'Nhap so thu 3 : $'

M4 db 13,10,' >>TBC 3 so : $'

Minus db '-$'

Du1 db '.33$'

Du2 db '.67$'

.Code

Main :

mov ax,@data

mov ds,ax

HienString Title1

HienString Title2

HienString Title3

HienString M1

call Vao_So_N

mov bx,ax

HienString M2

call Vao_So_N

mov cx,ax

HienString M3

call Vao_So_N

HienString M4

add bx,cx

add ax,bx

and ax,ax

jns L1

HienString Minus

neg ax

L1:

mov bx,3

xor dx,dx

div bx

call Hien_So_N

cmp dx,1

jb Exit

jz L2

HienString Du2

jmp Exit

L2:

HienString Du1

Exit :

mov ah,1

int 21h

mov ah,4ch

int 21h

Include Lib22.asm

End Main

1a:

.Model small

.Stack 100h

.Data

extrn _so1:WORD,_so2:WORD,_so3:WORD

.Code

Public @Tong$qv

@Tong$qv PROC

mov ax,_so1

mov bx,_so2

mov cx,_so3

add bx,cx

add ax,bx

ret

@Tong$qv ENDP

End

1c:

#include<stdio.h>

#include<iostream.h>

#include<conio.h>

extern int Tong();

int so1,so2,so3;

void main()

{

Start :

clrscr();

cout<<"

Hay vao so thu 1 : ";

cin>>so1;

cout<<"

Hay vao so thu 2 : ";

cin>>so2;

cout<<"

Hay vao so thu 3 : ";

cin>>so3;

cout<<"

------------------";

cout<<"

=> Tong 3 so la : "<<Tong();

cout<<"

=> TBC 3 so la : ";

float Sum=Tong();

printf("%0.2f",Sum/3);

cout<<"

Co tiep tuc CT khong ? (C/K) ";

char answer = getch();

if (answer=='c'|| answer=='C')

goto Start;

}

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

Tags: #asm