#include <iostream>
using namespace std;
class Beepers
{
public:
void beep();
void beepbeep();
};
void Beepers::beep()
{
asm
{
mov ah,2;
mov dl,7;
int 0x21;
}
}
void Beepers::beepbeep()
{
asm
{
mov ah,2;
mov dl,7;
int 0x21;
mov ah,2;
mov dl,7;
int 0x21;
}
}
int main()
{
Beepers noise;
noise.beep();
noise.beepbeep();
return 0;
}
大家看看是什么错误!
--------------------Configuration: derived - Win32 Debug--------------------
Compiling...
derived.cpp
E:\vc++\add\derived\derived.cpp(16) : error C2059: syntax error : '{'
E:\vc++\add\derived\derived.cpp(16) : error C2143: syntax error : missing ';' before '{'
E:\vc++\add\derived\derived.cpp(17) : error C2065: 'mov' : undeclared identifier
E:\vc++\add\derived\derived.cpp(17) : error C2146: syntax error : missing ';' before identifier 'ah'
E:\vc++\add\derived\derived.cpp(17) : error C2065: 'ah' : undeclared identifier
E:\vc++\add\derived\derived.cpp(18) : error C2146: syntax error : missing ';' before identifier 'dl'
E:\vc++\add\derived\derived.cpp(18) : error C2065: 'dl' : undeclared identifier
E:\vc++\add\derived\derived.cpp(19) : warning C4091: '' : ignored on left of 'int' when no variable is declared
E:\vc++\add\derived\derived.cpp(19) : error C2143: syntax error : missing ';' before 'constant'
E:\vc++\add\derived\derived.cpp(26) : error C2059: syntax error : '{'
E:\vc++\add\derived\derived.cpp(26) : error C2143: syntax error : missing ';' before '{'
E:\vc++\add\derived\derived.cpp(27) : error C2146: syntax error : missing ';' before identifier 'ah'
E:\vc++\add\derived\derived.cpp(28) : error C2146: syntax error : missing ';' before identifier 'dl'
E:\vc++\add\derived\derived.cpp(29) : warning C4091: '' : ignored on left of 'int' when no variable is declared
E:\vc++\add\derived\derived.cpp(29) : error C2143: syntax error : missing ';' before 'constant'
E:\vc++\add\derived\derived.cpp(30) : error C2146: syntax error : missing ';' before identifier 'ah'
E:\vc++\add\derived\derived.cpp(31) : error C2146: syntax error : missing ';' before identifier 'dl'
E:\vc++\add\derived\derived.cpp(32) : warning C4091: '' : ignored on left of 'int' when no variable is declared
E:\vc++\add\derived\derived.cpp(32) : error C2143: syntax error : missing ';' before 'constant'
执行 cl.exe 时出错.
derived.exe - 1 error(s), 0 warning(s)