- 首頁|
- 網(wǎng)校|
- 焚題庫|
- APP |
- 微信公眾號(hào)
三、改錯(cuò)題(本大題共5小題,每小題4分,共20分)
下面的類定義中有一處錯(cuò)誤,請(qǐng)寫出錯(cuò)誤所在行并給出修改意見。
41.#include<iostream.h>
template<class T>
T minx(T x,T y){
if(x>y)
x=y;
return x;
}
void main()
{
int a;
double d;
cout<<minx(a,d)<<endl;
}
42.#include<iostream.h>
class People{
public:
void People(){}
const int age()const{return 15;}
char * name(){return"Green";}
} ;
void main()
{
const People s;
int i=s.age();
cout<<"age="<<i<endl;
}