Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- using namespace std;
- int rnd(const int min = 0, const int max = 100)
- {
- return (int)rand() % (min - max) + min;
- }
- int zad1(const int a, const int b)
- {
- int wynik = 0;
- __asm
- {
- mov eax, a
- mov ebx, b
- cmp eax, ebx
- jge _koniec
- mov wynik, 44
- jmp _done
- _koniec:
- mov wynik, 10
- _done:
- }
- return wynik;
- }
- int zad2(const int a, const int b)
- {
- int wynik = 0;
- __asm
- {
- mov eax, a
- mov ebx, b
- cmp eax, ebx
- je _jump
- imul eax, ebx
- mov wynik, eax
- jmp _done
- _jump:
- mov wynik, 0
- _done:
- }
- return wynik;
- }
- int main()
- {
- srand((unsigned)time(0));
- int a = rnd(), b = rnd(), w;
- cout << " a : " << a << endl;
- cout << " b : " << b << endl;
- w = zad1(a, b);
- cout << "[Zad 1 ] : " << w << endl;
- w = zad2(a, b);
- cout << "[Zad 2 ] : " << w << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement