三、改错题(本大题共5小题,每小题2分,共10分)
下面的类定义中有一处错误,请用下横线标出错误所在行并给出修改意见。
41.#include<iostream.h>
main(){
int x=9,y=8,z=7;
const int * p=z;
cout<< * p<<endl;
}
42.#include<iostream.h>
main(){
int x=8,y=6;
const int*const p=&x;
p=&y;
cout<<* p<<endl;
}
43.#include<iostream.h>
main(){
folat p;
p=new folat[5];
for(int i=0;i<5;i++)
{cin>> * (p+i);cout<< * (p+i)<<endl;}
delete p;
}
44.template<class T>
T f(T x){
T y;
y=x+T;
return y;
}
45.#include<iostream.h>
class point{
int x;
public:void init(int a){x=a;}
int getx(){return x;}
void setx(int a){x=a;}
};
main(){
point a;
a.init(20,30);
cout<<a.getx()<<endl;
}