匯編語言輸入字符串并顯示 匯編語言怎么實現(xiàn)一個字符串的輸入與輸出?
匯編語言怎么實現(xiàn)一個字符串的輸入與輸出?匯編語言實現(xiàn)了字符串的輸入和輸出,可以調(diào)用DOS函數(shù)中斷來完成。示例程序如下:匯編語言輸入字符串,可以調(diào)用DOS函數(shù)interrupt int 21h 06h函
匯編語言怎么實現(xiàn)一個字符串的輸入與輸出?
匯編語言實現(xiàn)了字符串的輸入和輸出,可以調(diào)用DOS函數(shù)中斷來完成。示例程序如下:匯編語言輸入字符串,可以調(diào)用DOS函數(shù)interrupt int 21h 06h函數(shù)。程序功能:輸入一串字符,以回車結(jié)束,輸入字符串的最大長度為200個字符,輸入后在下一行輸出該字符串。數(shù)據(jù)段STR DB 201 dup(0dh)Data endscode段帳戶CS:code,ds:datamain proc far start:mov ax,Data mov ds,ax lea Si,STR mov CX,200inpstr:mov ah,06h int,21h JNZ inpstr no character readable mov[Si],A1 Inc Si XOR Al,0dh JZ Endinp loop inpstrandip:mov Al,0dh mov[Si],A1 mov DL,0ah回車,換行mov ah,02hint 21h mov DL,0dh mov ah,02h int 21h lea Si,STR output string:mov DL,[Si]CMP DL,0dh JZ end out to the end of the string mov ah,02h int 21h Inc Si JMP outputted:mov ah,4CH int 21h retmain endpcode ends end start
匯編語言實現(xiàn)了字符串的輸入和輸出,可以通過調(diào)用DOS函數(shù)中斷。示例程序如下:匯編語言輸入字符串,可以調(diào)用DOS函數(shù)中斷int21h06h函數(shù)。程序功能:輸入一串字符,以回車結(jié)束,輸入字符串的最大長度為200個字符,輸入后在下一行輸出該字符串。數(shù)據(jù)段strdb201dup(0dh)數(shù)據(jù)段tassumecs:代碼,ds:數(shù)據(jù)維護cfarstart:移動硬盤,數(shù)據(jù)移動,axleasi,strmovcx,200輸入:movah,06hint21hjnzinpstr,無字符可讀mov[Si],十六進制,0dhjzendinloopinp強度:moval,0dhmov[Si],a1movdl,0ah回車,換行符movah,02hint21hmovdl,0dhmovah,02hint21hleasi,STR輸出字符串o輸出:movdl,[Si]cmpdl,0dhjzendout已到達字符串movah的末尾,02hint21hincsijmpout輸出:movah,4chint21hretmaindpcodendsendstart
匯編語言怎么實現(xiàn)一個字符串的輸入與輸出?
#include<stdio.h>
int main(void)
{
char c
while((c=getchar())!=EOF)
{
if(c>=“a”&&c<=“z”)
{
c=“a”-“a”
}
else if(c>=“a”&&c<=“z”)
{
c=“a”-“a”
}
putchar(c)
}
return 0
}
00