下面程序有注释的语句中,错误的语句是( )。 #include <iostream> using namespace std; class A{ int a; public: void show A(){cout<<"this is A!";} }; class B:public A{ int b; public: void show B(){cout<< "this is B!";} }; void main(){ A ia,*piA; B ib,*piB; piA=ia; //第一个测试语句 piA=&ib; //第二个测试语句 piA->showA(); //第三个测试语句 piA->showB(); //第四个测试语句 }
A.第一个测试语句
B.第二个测试语句
C.第三个测试语句
D.第四个测试语句
第1题:
下面程序错误的语句是 #include" iostream.h" ① void main( ) ② { ③ int A=0; ④ int & B; ⑤ B=A; ⑥ cout < < B; ⑦ cout < < A; ⑧ }
A.②
B.③
C.④
D.⑥
第2题:
设有如下定义 struct ss { char name[10]; int age; char sex; }std[3], * p=std; 下面各输入语句中错误的是
A.cin>>(* p).age);
B.cin>>std.name);
C.cin>>std[0].sex);
D.cin>>(p->.sex));
第3题:
9、有以下说明和定义语句,下面各输入语句中错误的是 #include <stdio.h> int main() { struct student { int age; char sex; char name[8]; }; struct student std; struct student *p=&std; ....... return 0; }
A.scanf("%c",&std[0].sex);
B.scanf("%d",&(*p).age);
C.scanf("%s",std.name);
D.scanf("%c",&(p->sex));
第4题:
下面程序错误的语句是 #include"iostream.h" ① void main() ② { ③ int A=0; ④ int & B; ⑤ B=A ⑥ cout<<B; ⑦ cout<<A; ⑧ }
A.②
B.③
C.④
D.⑥
第5题:
下面程序错误的语句是
①#include<iostream.h>
②void main()
③{
④ int * p=new int[1]
⑤ p=9
⑥ cout<<* p<<end1;
⑦ delete []p;
⑧}
A.④
B.⑤
C.⑥
D.⑦