下述程序中语句完全不正确的一组语句是()
下述程序中语句完全不正确的一组语句是()
classautomover{
intwheels;floatweight;public:
voidinitialize(int,float);intget_wheels();floatget_weight(){returnweight;}
};voidautomover::initialize(intin_wheels,floatin_weight)
{wheels=in_wheels;weight=in_weight;}
intautomover::get_wheels(void){returnwheels;}
voidmain()
{automovercar;automover.initialize(4,3000.0);//①
car.wheels=4;//②
car.weight=3000.0;//③
car.initialize(4,3000.0);//④
cout<<"Thecarhas"<<car.wheels<<"wheels.";//⑤
cout<<"Thecarweighs"<<car.weight<<"pounds.";//⑥
cout<<"Thecarhas"<<car.get_wheels()<<"wheels.";//⑦
cout<<"Thecarweighs"<<car.get_weight()<<"pounds.";//⑧
}
A.①、②、③、④、⑤
B.①、②、③、⑤、⑥
C.②、③、④、⑤、⑥
D.①、②、④、⑦、⑧
正确答案:①、②、③、⑤、⑥
- 上一篇:()是不可以作为该类的成员的。
- 下一篇:设有以下类和对象的定义:classA