Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ïîèñê íåïàðíîãî.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include<conio.h>
- using namespace std;
- int main()
- {
- int ar[4] = { 128, 32, 2, 32};
- int x = 8;
- int res = 0;
- int ans = 0;
- int ans1 = 0;
- int ans2 = 0;
- __asm
- {
- mov edx, 3
- L:
- mov eax, ar[edx * 4]
- xor ebx, ebx
- mov ecx, 32
- //mov eax, x
- shifting :
- shl eax, 1
- jnc skip_inc
- inc ebx
- skip_inc :
- loop shifting
- mov res, ebx
- cmp res, 1
- jne cont
- inc ans
- cont:
- dec edx
- cmp edx, 0
- jl fin
- jmp L
- fin:
- mov eax, ans
- mov ans1, eax
- xor ebx, ebx
- mov ecx, 32
- shifting2 :
- shl eax, 1
- jnc skip_inc2
- inc ebx
- skip_inc2 :
- loop shifting2
- mov ans2, ebx
- }
- cout << "Elementov stepenei dvoiki: " << ans1 << endl;
- cout << "V chisle: " << ans1 << " edinits " << ans2;
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement