seriously ? guess I'm clueless there after 2s thinking lolm0skit0 wrote:Write a program that checks if one string is part of another (if it's a substring).
Write the same program without using any loop construct (for, while, etc...)![]()
Advertising
seriously ? guess I'm clueless there after 2s thinking lolm0skit0 wrote:Write a program that checks if one string is part of another (if it's a substring).
Write the same program without using any loop construct (for, while, etc...)![]()
2s thinking? your a god! I wouldn't have lasted half a secondwth wrote: seriously ? guess I'm clueless there after 2s thinking lol
You can do it recursively. Not impossible at all.wth wrote:indeed pretty pointless trying such impossible thing imho xD

here you go bruh, code:m0skit0 wrote:All I see is too much talking and no code![]()
Code: Select all
; multi-segment executable file template.
data segment
; add your data here!
msj_pedirCadena DB "Introduzca una cadena:$"
msj_resultado DB "La cadena resultante es:$"
saltoLinea DB 10, 13, '$'
cadenaL DB 23 DUP(?)
cadenaR DB 41 DUP(?)
ends
stack segment
dw 128 dup(0)
ends
code segment
;en el registro DX se encuentra la dirección de la cadena a imprimir
Imprimir PROC
push ax
mov ah, 9
int 21h
pop ax
ret
Imprimir ENDP
;en el registro DX se encuentra la dirección de la cadena donde se
;almacenará el resultado de la lectura por teclado
LeerCadena PROC
push ax
mov ah, 0ah
int 21h
pop ax
ret
LeerCadena ENDP
SepararCaracteres PROC
push ax
push cx
push si
push di
mov si, 2
mov di, 0
mov cl, cadenaL[1]
mov ch, 0
mov si, cx
inc si
cmp cx, 0
je finSepararCaracteres
bSepararCaracteres:
mov al, cadenaL[si]
mov cadenaR[di], al
inc di
dec si
loop bSepararCaracteres
finSepararCaracteres:
mov cadenaR[di], '$'
pop di
pop si
pop cx
pop ax
ret
SepararCaracteres ENDP
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax
; add your code here
lea dx, msj_pedirCadena
call Imprimir
lea dx, saltoLinea
call Imprimir
lea dx, cadenaL
mov cadenaL[0], 21
call LeerCadena
lea dx, saltoLinea
call Imprimir
call SepararCaracteres
lea dx, msj_resultado
call Imprimir
lea dx, saltoLinea
call Imprimir
lea dx, cadenaR
call Imprimir
; wait for any key....
mov ah, 1
int 21h
mov ax, 4c00h ; exit to operating system.
int 21h
ends
end start ; set entry point and stop the assembler.