问答题

{{*HTML*}}给出下面程序输出结果。
#include <iostream.h>
void main()
{int *p1;
int * *p2=&p1;
int b = 20;
p1 =&b;
cout<<* * p2<<endl;
}

【参考答案】

此题暂无答案,小编努力补充中……
<上一题 目录 下一题>
热门 试题

问答题
{{*HTML*}}在下面程序横线处填上适当的语句,使其输出结果为0,15,15。#include <iostream.h>class base{ public:______ f() { return 0; }};class derived:public base{ public:int a,b,c;______ set(int x, int y, int z) {a =x; b =y; c =z;}int f() { return a + b + c ; }};void main(){ base b;derived d;cout<<b.f()<< , ;d.set(3,5,7);cout<<d.f()<< , ;base &p = d;cout<<p.f()<<endl;}
问答题
完成下面类中成员函数的定义。#include <iostream.h>#include <iomanip.h>class Arr{ protected:float * p;int n; 数组大小(元素个数)public:Arr( int sz = 10){ n=sz;p = new float[n];}~ Arr (void){______}int Getn(void) const{return n;}float & operator[] (int i){______}void Print();};void Arr::Print(){ int i;for(i=0; i < this->Getn(); i ++){if (i%10==0)cout<<endl;cout<<setw(6)<<p[i];}cout<<endl;}void main(){Arr a(20);for (int i=0; i<a.Getn(); i ++ )a[i] =i*2;a.Print();}
相关试题
  • {{*HTML*}}下面Shape类是一个表示形...
  • {{*HTML*}}给出下面程序输出结果。#...