纠错
全专业资料、题库、学位、网课
最高直省2344元
上千+科次精品网课
买网课即送全真模考题库
五千+科次教材资料
电子资料满三件9折
五千+科次在线题库
全真呈现历年考试试题
1、[主观题]C++语言的类是由数据和对数据进行操作的函数组成,它们分别叫做类的___和类的___。
2、[主观题]写出下面程序的输出结果。#includeclassFunArray{int*pa;//指向一个数组空间intsize;//数组元素个数public:FunArray(inta[],intthesize):pa(a),size(thesize){}intSize{returnsize;}intoperator[](intindex){returnpa[index-1];}};voidmain{ints[]={3,7,2,1,5,4};FunArrayma(s,sizeof(s)/sizeof(int));ma[3]=9;for(inti=1;i
3、[主观题]下面是以传统形式的struct来定义一存放字符的栈类型,并定义了有关栈操作的各种函数。编写一主函数,定义并输入一个字符串,用此串来验证栈的各种操作,包括把串压入栈中后再弹出,以相反的次序将它们显示出来。#include″iostream.h″constmax—len=1000;enunboolean{—false,—true};enum{EMPTY=-1,FULL=max—len-1};structstack{chars[max—len];inttop;};voidreset(stack*st){st->top=EMPTY;}voidpust(charc,stack*st){st->top++;st->s[st->top]=c;}charpop(stack*st){return(st->s[st->top--]);}chartop(stack*st){return(st->s[st->top]);}booleanempty(conststack*st){return(boolean)(st->top==EMPTY);}booleanfull(conststack*st){return(boolean)(st->top==FULL);}
4、[主观题]给出类:classthree—d{intx,y,z;public:three—d(inti,intj,intk){x=i,y=j,z=k;}three—d{x=0;y=0;z=0;}voidget(inti,intj,intk){i=x;j=y;k=z;}};针对给出的类,重载“+”运算符,以便使“+”运算符可以接受下面的运算类型:ob+int;imt+ob;其中ob为three—d类对象。
5、[主观题]在下面程序中的横线处填上适当内容,使程序完整。#includeclassvehicle{protected:intsize;intspeed;public:voidsetSpeed(ints){speed=s;}①___getSpeedLevel{returnspeed/10;}};classcar:pubicvehicle{public:intgetSpeedLeve{returnspeed/5;}};classtruck:publicvehicle{public:intgetSpeedLevel{returnspeed/15;}};intmaxSpeedLevel(vehicle②___,vehicle③___){if(v1.getSpeedLevel>v2.getSpeedLevel)return1;elsereturn2;}voidmain{truckt;carc;t.setSpeed;c.setSpeed;cout
Copyright © 2010 - 2023 湖南求实创新教育科技有限公司 All Right Reserved.
温馨提示:如您需要的资料本网暂时没有,请于工作日08:00-18:00,点击这里,联系客服及时补充资料。