正确答案: D
题目:下面各选项中,均是C语言中合法标识符的选项组是
解析:本题主要考查标识符的定义。对标识符的定义是历次考试中常考的内容之一。标识符主要由数字、下画线和字母组成,其中数字不能放在首位,另外,用户自定义标识符时,不能将标识符定义为C语言中已定义的关键字,如short、for、void等。
举一反三的答案和解析:
以下程序的执行结果是 ______。 #includeiostream.h> class Sample { int x; public: Sample(){}; Sample(int a){x=a;} Sample(Sample &a){x=a.x+1;} void disp(){cout"x="xend1;} } void main() { Sample s1(2),s2(s1); s2.disp(); }
有如下程序: #include iostream> using namespace std; class Base { public: Base(){ cout"BB";f(); } void f() { cout"Bf";} }; class Derived:public Base { public: Derived() { cout"DD"; } void f(){ cout"Df"; } }; int main(){ Derived d; return 0;}执行上面的程序将输出______ 。