Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int a,i=0; //a-число, i-порядок
- cout<<"Type a: ";
- cin>>a;
- __asm{
- mov eax,a
- //модуль числа
- cmp eax,0
- jg a_less_0
- jmp a_greater_0
- a_less_0:
- jmp abs_
- a_greater_0:
- mov ebx,-1
- imul ebx
- jmp abs_
- abs_:
- mov ecx,eax
- //порядок числа
- beg_ord:
- cmp eax,0
- jle end_ord
- mov ebx,10
- cwd
- idiv ebx
- //i++
- mov ebx,i
- add ebx,1
- mov i,ebx
- jmp beg_ord
- end_ord:
- }
- cout<<"Число "<<a<<" Порядок "<<i<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement