Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;#include <iostream.h>
- ;int main()
- ;{
- ; int a;
- ; int n1, n2, n3;
- ; cout << "Число" << endl;
- ; cin >> a;
- ; system("cls");
- ; n1 = a / 100;
- ; n2 = (a - n1 * 100) / 10;
- ; n3 = (a - n1 * 100 - n2 * 10);
- ; cout << n1 << n2 << n3 << endl;
- ; cout << n1 << n3 << n2 << endl;
- ; cout << n2 << n1 << n3 << endl;
- ; cout << n2 << n3 << n1 << endl;
- ; cout << n3 << n2 << n1 << endl;
- ; cout << n3 << n1 << n2 << endl;
- ; system("pause");
- ; return 0;
- ; }
- global main
- extern printf, scanf
- section .data
- i_msg db "Enter 3-znachne chislo: ",10,0
- i_fmt db "%d",0
- o_fmt db "Result: %d", 10, 0
- o_fmtt db "n10: %d", 10, 0
- o3_fmt db "Result: %d", 0
- n100 dq 100.0
- n10 dq 10.0
- section .bss
- x resb 4
- n1 resb 4
- n2 resb 4
- n3 resb 4
- tmp resb 4
- section .text
- main:
- mov rcx, i_msg
- sub rsp, 40
- call printf
- add rsp, 40
- mov rdx, x
- mov rcx, i_fmt
- sub rsp, 40
- call scanf
- add rsp, 40
- ;n1 = x / 100
- fld qword[x]
- fdiv qword[n100]
- fstp qword[n1]
- ;n2 = (a - n1 * 100) / 10;
- ;1. n * 100
- fld qword[n1]
- fmul qword[n100]
- fstp qword[n2]
- ;2. a - 100
- fld qword[x]
- fsub qword[n2]
- fstp qword[n2]
- ;3. n2 / 10
- finit
- fld qword[n2]
- fdiv qword[n10]
- fstp qword[n2]
- mov rcx, o_fmt
- mov rdx, qword[n1]
- sub rsp, 40
- call printf
- add rsp, 40
- mov rcx, o_fmt
- mov rdx, qword[n2]
- sub rsp, 40
- call printf
- add rsp, 40
- xor rax, rax
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement