Mix (C++ and Assembly) Program to Find Whether Number is Positive or Negative

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a;
cout<<"\n Enter a number:";
cin>>a;
asm mov ax,0000h
asm mov ax,a
asm cmp ax,0000h
asm jl less
asm jge greater
less:
cout<<"\n Number is negative";
asm jmp end
greater:
cout<<"\n Number is positive";
end:
getch();
}

/* OUTPUT

 Enter a number:8

 Number is positive

 Enter a number:-32

 Number is negative

*/

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.