Mix (C++ and Assembly) Program to Check if String is Palindrome or not
This C++ program checks whether a given array of five integers is a palindrome (i.e., reads the same forwards and backwards) using inline 8086 assembly instructions. It utilizes basic comparison instructions and control flow to determine equality between symmetric elements. #include<iostream.h> #include<conio.h> void main() { int nos[5], x, y; cout << "\n Enter 5 numbers:"; int i, j; for (i = 0; i < 5; i++) { cin >> nos[i]; } for (i = 0, j = 4; i < 3; i++, j--) { x = nos[i]; y = nos[j]; _asm { mov ax, x mov bx, y cmp ax, bx jnz no } } cout << "\n Array is Palindrome."; goto end; no: cout << "\n Array is not palindrome."; end: getch(); }