jackall
May 12th, 2008, 01:17
The code below compiles all right....
Here i tried to introduce a block of asm code into c++ ; to substitute the c=a+b part of the code
But it doesnot compile..??
Error is shown at the line _asm .!!
What is/are the errors ?
The platform :
Xp professional version 2002 service pack2
Intel(R) Pentium(R)D CPU 2.66GHz 2.67GHz
Any suggestion, modification or observation would be greatly appreciated .
Thank you.
Code:
int main ()
{
int a, b, c;
cout<<"Enter a number\n";
cin>>a;
cout<<" A Second number to add\n";
cin>>b;
cin.ignore ();
c=a+b;
cout<<"Result is :"<< c<<endl;
cin.get ();
return 0;
}
Here i tried to introduce a block of asm code into c++ ; to substitute the c=a+b part of the code
Code:
#include<iostream>
using namespace std;
int main ()
{
int a,b,c;
cout<<"Enter a number\n";
cin>>a;
cout<<"A Second number to add\n";
cin>>b;
cin.ignore();
_asm {
mov eax,a
mov ebx,b
add eax,ebx
mov c,eax
}
cout<<"Result is:"<<c<<endl;
cin.get();
return 0;
}
But it doesnot compile..??
Error is shown at the line _asm .!!
What is/are the errors ?
The platform :
Xp professional version 2002 service pack2
Intel(R) Pentium(R)D CPU 2.66GHz 2.67GHz
Any suggestion, modification or observation would be greatly appreciated .
Thank you.