I am new to Assembler and I have the following question: there is a sequence of integers. It is necessary to determine whether this sequence is ordered. How to implement it? I could only write array initialization
#include <iostream> #include <cstdlib> #include <ctime> #include <Windows.h> using namespace std; int main() { setlocale(LC_ALL, ".1251"); int f1, f2; // границы интегрирования int numb; // количество элементов последовательности int f; // счетчик, пока не заполним наш массив int x; //элемент последовательности int *num, *num2; //массивы int i, z = 0, k = 0, a, b; cout << "Введите количество элемнетов последовательности: "; cin >> numb; num = new int[numb]; num2 = new int[numb]; srand(time(NULL)); cout << "Введите границы генерирования чисел последовательности от "; cin >> f1; cout << "До "; cin >> f2; cout << "Элементы исходной последовательности:" << endl; _asm { xor ecx, ecx xor edi, edi // смещение относительно начала массива xor ebx, ebx xor edi, edi mov ecx, numb mov f, ecx mov edi, num mov ebx, num2 cycle1 : xor eax, eax xor edx, edx } x = rand() % (f2 - f1 + 1) + f1; cout << x << " "; _asm { xor eax, eax xor esi, esi mov edx, z mov eax, x cmp edx, 0 je insert find1 : cmp eax, [edi][esi] je ravno add esi, 4 cmp esi, edx je insert jmp find1 ravno : inc[ebx][esi] jmp end1 insert : mov[edi][edx], eax mov eax, 1 mov[ebx][edx], eax add edx, 4 inc k end1 : dec f cmp f, 0 mov z, edx mov eax, [ebx][0] mov a, eax mov edx, [edi][0] mov b, edx jne cycle1 } cout << endl; }