下述程序中语句完全不正确的一组语句是()


下述程序中语句完全不正确的一组语句是()

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.①、②、④、⑦、⑧

正确答案:①、②、③、⑤、⑥


Tag:面向对象的C++和Windows编程 语句 程序 时间:2021-12-25 13:54:43