ขนาดวิดีโอ: 1280 X 720853 X 480640 X 360
แสดงแผงควบคุมโปรแกรมเล่น
เล่นอัตโนมัติ
เล่นใหม่
I would add a control on the input like verify if the input is a number and change the type of "side" from int to float
it's a square....also floating point numbers make more sense...
Easy! I could do this in Assembly.Code:section .data prompt db "Enter the side: ", 0 output db "The area of square is ", 0 side dd 0 area dd 0 section .bsssection .text global _start_start: mov eax, 4 mov ebx, 1 mov ecx, prompt mov edx, 17 int 0x80 mov eax, 3 mov ebx, 0 lea ecx, [side] mov edx, 4 int 0x80 sub byte [side + 1], 0x30 mov eax, [side] imul eax, eax mov [area], eax push dword [area] push output call printf add esp, 8 mov eax, 1 int 0x80
Assembly is just something else man...
@@scaleofperspective6211 I'm just a average Assembly programmer
I would add a control on the input like verify if the input is a number and change the type of "side" from int to float
it's a square....
also floating point numbers make more sense...
Easy! I could do this in Assembly.
Code:
section .data
prompt db "Enter the side: ", 0
output db "The area of square is ", 0
side dd 0
area dd 0
section .bss
section .text
global _start
_start:
mov eax, 4
mov ebx, 1
mov ecx, prompt
mov edx, 17
int 0x80
mov eax, 3
mov ebx, 0
lea ecx, [side]
mov edx, 4
int 0x80
sub byte [side + 1], 0x30
mov eax, [side]
imul eax, eax
mov [area], eax
push dword [area]
push output
call printf
add esp, 8
mov eax, 1
int 0x80
Assembly is just something else man...
@@scaleofperspective6211 I'm just a average Assembly programmer