长沙理工大学试卷标准答案课程名称:C++程序设计试卷编号:17-1-一、填空题(每小题1分,共15分)1.intfloatdoublechar2.if(表达式)语句if(表达式)语句else语句if(表达式)语句elseif(表达式)语句…else语句3.main()4.05.;6.公有(public)私有(private)保护(protected)7.静态绑定动态绑定二、项选择题(每小题2分,共20分)1.C2.A3.C4.A5.C6.C7.C8.D9.A10.A三、阅读程序填空题(每空3分,共15分)1.①int*p;②p2=p③ab2.④p+=2⑤*p++3.⑥p⑦arr[0].score⑧intk=0;四、阅读程序写输出结果(每小题5分,共20分)1.运行结果为101210412.运行结果为:max=10,row=3,colum=13.运行结果为:1第2页共3页114.运行结果为:10178.510180.5五、编程题(每小题10分,共30分)下述答案仅供参考,若采用其它方法答案,只要正确实现题目要求即可。1.#includeiostream.husingnamespacestd;intmain(){intx,y;cout”enterx:”;cinx;if(x=0)y=0;elseif(x0)y=-1;elsey=1cout”y=”yendl;return0;}2.#includeiostream.hmain(){inti,num=0,a;floatsum=0;for(i=0;i10;i++){cina;if(a=0)continue;num++;sum+=a;第3页共3页}coutnumplusinteger'ssum:sumendl;coutMeanvalue:sum/numendl;}3.classCircle{public:voidSetRadius(){cinr;}intArea(){return3.14159*r*r;}private:floatr;}