假定有定义“intb[10];int*pb;”,则不正确的赋值语句为()。A、pb=b;B、pb=b[0];C、pb=new int;D、pb=b[5];
假定有定义“intb[10];int*pb;”,则不正确的赋值语句为()。
- A、pb=b;
- B、pb=&b[0];
- C、pb=new int;
- D、pb=b[5];
相关考题:
设有C语言变量说明“static int a[][2]={{1,2),(3,4}};int *pa,(*pb)[2];”,则执行语句“pa=pb=”,则执行语句“pa=pb=a[0][0];”后,(*(pa+1))的值为(31)。A.2B.3C.a[0][1]D.a[1][0]
有以下程序 include using namespace std; class Base { int a; public: Base(int x) 有以下程序include <iostream>using namespace std;class Base{int a;public:Base(int x){ a=x; }void show(){ cout<<a; }class Derived : public Base{int b;public:Derived(int i) :Base(i+1),b(i){}void show() { cout<<b;};int main (){Base b(5),*pb;Derived d(1);pb=d;pb->show ();return 0;}运行后的打印结果是______。
如下程序执行后的输出结果是【】。include using namespace std; class Base { public: 如下程序执行后的输出结果是【 】。include <iostream>using namespace std;class Base{public:Base(int x,int y){a=x;b=y;}void Show(){cout<<"Base: "<<a<< ',' <<b<<" ";}private:int a,b;};class Derived : public Base{public:Derived(int x, int y, int z) : Base(x,y),c(z) { }void Show(){cout<<"Derived:"<<c<<end1;}private:int c;};int main(){Base b(100,100),*pb;Derived d(10,20,30);pb=b;pb->Show();pb=d;pb->Show();return 0;}
下列程序中,正确的为______。A.main() { int *pb=b; float 1>=15.25; print f("%d\n" ,*pb); }B.amin() { int a,*pa; a=10; *pa=a; prinffC%d",*pa); }C.main() { char s[20]; char *ps=s; scanf("%s",*p); printf("%s",*p); }D.main() { char str[10]; int *ps=str[0]; str="abcdefg"; printf("%s",*p); }
为使程序的输出结果为: Base:: fun 那么应在下列程序画线处填入的正确语句是( )。 #include <iostream> using namespace std; class Base { public: void fun () { cout<<"Base: :fun"<<end1; } }; class Derived : public Base { public: void fun ( ) { cout<<"Derived: :fun"<<end1; } }; int main ( ) { Base a,*pb; Derived b; _________; pb->fun(); //调用基类的成员函数 fun() return 0 ; }A.pb=aB.pb=bC.pb=bD.pb=Base
有以下程序:inClUdeusingnamespacestd;ClassBase{public: Base(intx) {a=x; } voidsh 有以下程序: #inClUde <iostream> using namespace std; Class Base { public: Base(int x) { a=x; } void show() { cout<<a; } private: int a; }; class Derived : public Base { public: Derived(int i) :Base(i+1),b(i){} void Show() { cout<<b; } private: int b; }; int main() { Base b(5),*pb; Derived d(1); pb=d; pb->show(); return 0; } 运行后的输出结果是( )。A.1B.5C.2D.0
假定变量b和pb定义为“intb[10],*pb=b;”,要将24赋值给b[l]元素中,不正确的赋值语句是()。A、*(pb+l)=24B、*(b+l)=24C、*++b=24D、*++pb=24
单选题假定变量b和pb定义为“intb[10],*pb=b;”,要将24赋值给b[l]元素中,不正确的赋值语句是()。A*(pb+l)=24B*(b+l)=24C*++b=24D*++pb=24