Advertisement
Guest User

Untitled

a guest
May 8th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. ;#include <iostream.h>
  2.  
  3. ;int main()
  4. ;{
  5.  
  6. ; int a;
  7. ; int n1, n2, n3;
  8. ; cout << "Число" << endl;
  9. ; cin >> a;
  10. ; system("cls");
  11.  
  12. ; n1 = a / 100;
  13. ; n2 = (a - n1 * 100) / 10;
  14. ; n3 = (a - n1 * 100 - n2 * 10);
  15.  
  16. ; cout << n1 << n2 << n3 << endl;
  17. ; cout << n1 << n3 << n2 << endl;
  18. ; cout << n2 << n1 << n3 << endl;
  19. ; cout << n2 << n3 << n1 << endl;
  20. ; cout << n3 << n2 << n1 << endl;
  21. ; cout << n3 << n1 << n2 << endl;
  22. ; system("pause");
  23.  
  24. ; return 0;
  25. ; }
  26.  
  27.  
  28. global main
  29. extern printf, scanf
  30.  
  31. section .data
  32. i_msg db "Enter 3-znachne chislo: ",10,0
  33. i_fmt db "%d",0
  34. o_fmt db "Result: %d", 10, 0
  35. o_fmtt db "n10: %d", 10, 0
  36. o3_fmt db "Result: %d", 0
  37.  
  38. n100 dq 100.0
  39. n10 dq 10.0
  40.  
  41. section .bss
  42. x resb 4
  43. n1 resb 4
  44. n2 resb 4
  45. n3 resb 4
  46. tmp resb 4
  47.  
  48. section .text
  49. main:
  50.  
  51. mov rcx, i_msg
  52. sub rsp, 40
  53. call printf
  54. add rsp, 40
  55.  
  56. mov rdx, x
  57. mov rcx, i_fmt
  58. sub rsp, 40
  59. call scanf
  60. add rsp, 40
  61.  
  62. ;n1 = x / 100
  63. fld qword[x]
  64. fdiv qword[n100]
  65. fstp qword[n1]
  66.  
  67. ;n2 = (a - n1 * 100) / 10;
  68.  
  69. ;1. n * 100
  70. fld qword[n1]
  71. fmul qword[n100]
  72. fstp qword[n2]
  73. ;2. a - 100
  74. fld qword[x]
  75. fsub qword[n2]
  76. fstp qword[n2]
  77. ;3. n2 / 10
  78. finit
  79. fld qword[n2]
  80. fdiv qword[n10]
  81. fstp qword[n2]
  82.  
  83.  
  84. mov rcx, o_fmt
  85. mov rdx, qword[n1]
  86. sub rsp, 40
  87. call printf
  88. add rsp, 40
  89.  
  90.  
  91. mov rcx, o_fmt
  92. mov rdx, qword[n2]
  93. sub rsp, 40
  94. call printf
  95. add rsp, 40
  96.  
  97.  
  98.  
  99. xor rax, rax
  100. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement