I am using Visual Studio 2019 Developer Command Prompt. The inline assembly code is simple division and remainder. There is no error in compilation using the command cl /EHsc filename.cpp
. Absolutely nothing is displayed on the screen. It takes up to 4 seconds of runtime.
#include<iostream>
using namespace std;
int main()
{
int x=10,y=20;
int z=0,r=0;
//z=x/y
//r=x%y
__asm
{
MOV EAX,x
IDIV y
MOV z,EAX
MOV r,EDX
}
cout<<"z = "<<z<<"\tr = "<<r<<endl;
return 0;
}