题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-11-17 23:28:17

[简答题]使用VC6打开考生文件夹下的工程RevProj8。此工程包含一个源程序文件 RevMain8.cpp。在该文件中,函数resort的功能是:能在一个数列中,对从指定位置开始的几位数,按相反顺序重新排列,并在主函数中输出新的序列。
请改正程序中的错误,使它能得到正确结果。
注意,不要改动main函数,不得删行或增行,也不得更改程序的结构。
源程序文件RevMain8.cpp中的程序清单如下:
//RevMain8.cpp
#include <instream>
using namespace std;
void resort(int arr[],int where,int amount);
int main ( )

int number [20] ,where, arrount, i;
cout<<"Input 20 numbers/n";
for (i=0; i<20; i++)
cin>>number [i];
cout<<"How many do you want to sort: ";
cin>>arrount;
cout<<"/n where do you want to start: ";
cin>>where;
cout<<"old array as follow:/n";
for (i=0; i<20; i++)
cout<<nmuber [i] <<" ";
resort (number,where, arrount);
cout<<"/n resorted array as follow:/n";
for (i=0; i<20; i++)
cout<<number [i] <<" ";
cout<<end1;
return 0;

void resort(int array[],in

更多"使用VC6打开考生文件夹下的工程RevProj8。此工程包含一个源程序"的相关试题:

[简答题]使用VC6打开考生文件夹下的工程MyProj6。此工程包含一个源程序文件MyMain6.cpp。在程序中,定义了一个Furniture类,Bed类和Sofa类是在Furniture类的基础上按公有继承的方式产生的派生类,Sleepersofa类是在Bed类和Sofa类的基础上按公有继承的方式产生的派生类。
请按要求完成下列操作,将类Date的定义补充完成:
①Bed类是在Furniture类的基础上按公有继承的方式产生的派生类,为了使程序中的多重继承关系不出现二义性。请在注释“//**1**”之后添加适当的语句。
②Sofa类是在Furniture类的基础上按公有继承的方式产生的派生类,为了使程序中的多重继承关系不出现二义性。请在注释“//**2**”之后添加适当的语句。
③Sleepersofa类是在Bed类和Sofa类的基础上按公有继承的方式产生的派生类。请在注释“//**3**”之后添加适当的语句。
注意:除在指定位置添加语句之外,请不要改动程序中的其他内容。
源程序文件MyMain6.cpp清单如下;
//MyMain6.cpp
#include<iostream>
using namespace std;
class Furniture

public:
Furniture( )
void setweight(int w)

weight=w;

int getweight( )

return weight;

protected:
int weight;
;
//* *1 * * class Bed definition

public:
Bed( )
void sleep( )

cout<<"sleeping..."<<end1;


//* *2* * class Sofa definition

public:
Sofa( )

[简答题]使用VC6打开考生文件夹下的工程RevProj7。此工程包含一个源程序文件RevMain6.cpp,但该程序运行有问题。请改正主函数中的错误,使程序的输出结果是:
MyNumber=0
MyNumber=1
MyNumber=2
源程序文件RevMain6.cpp清单如下:
//RevMain6.cpp
#include<iostream>
using namespace std;
class MyClass

public:
MyClass(int i)

MyNumber=i;

void SetMember(int m)

MyNumber=m;

int GetMember( )const

return MyNumber;

void Print( ) const

cout<<"MyNumber="<<MyNumber<<end1;

private:
int MyNumber;
;
int main( )

/* * * * * * * * *found* * * * * * * * *
MyClass *pObj=new MyClass(O);
pObj.Print( );
/* * * * * * * * *found* * * * * * * * *
pObj->MyNumber = 1;
pObj->Print( );
/* * * * * * * * *found* * * * * * * * *
MyClass. SetMember(2);
(*pObj).Print( );
return O;

[多项选择]综合应用题 使用VC6打开考生文件夹下的工程test6_3,此工程包含一个源程序文件test6_3.cpp,其中定义了用于表示考生的类Student,请按要求完成下列操作,将程序补充完整。 (1)定义私有数据成员code、english分别用于表示考生的编号、英语成绩、它们都是int型的数据。请在注释"//**1**"之后添加适当的语句。 (2)完成成员函数void Student::inputinformation( )的定义,该函数用于用户输入一个考生对象的信息,输入格式如下所示: 输入编号: 英语成绩: 计算机成绩: 请在注释"//**2**"之后添加适当的语句。 (3)利用已实现的类Student的成员函数,完成函数void firstname(Student *A[],int num)的定义,该函数根据考生信息A[],输出num个考生中总分最高者的编号及其相应的总分,在此不考虑总分相同的情况。请在注释"//**3**"之后添加适当的语句。 注意:除在指定位置添加语句之外,请不要改动程序中的其他内容。 源程序文件test6_3.cpp清单如下: #include class Student { //**1** int computer; int total; public: void getinformation( ); void computesum( ); int getcode( ); int gettotalscore( ); ~Student( ); }; void Student::getinformation( ) { //**2** cout<<"英语成绩:"; cin>>english; cout<<"计算机成绩:"; cin>>computer; } void Student::computesum( ) { total=english+computer; cout<<"编号"<
[简答题]使用VC6打开考生文件夹下的工程tsst6_3,此工程包含一个源程序文件test6_3.cpp,其中定义了用于表示考生的类 Student,请按要求完成下列操作,将程序补充完整。
(1)定义私有数据成员code、english分别用于表示考生的编号、英语成绩、它们都是int型的数据。请在注释“//**1**”之后添加适当的语句。
(2)完成成员函数void Student::inputinformation( )的定义,该函数用于用户输入一个考生对象的信息,输入格式如下:
输入编号:
英语成绩;
计算机成绩:
请在注释“//**2**”之后添加适当的语句。
(3)利用己实现的类Student的成员函数,完成函数void firstname(Student *A[],int num)的定义,该函数根据考生信息 A[],输出num个考生中总分最高者的编号及其相应的总分,在此不考虑总分相同的情况。请在注释“//**3**”之后添加适当的语句。
注意:除在指定位置添加语句之外,请不要改动程序中的其他内容。
源程序文件test6_3.cpp清单如下:
#include<iostream.h>
class Student

//**1**
int computer;
int total;
public:
void getinformation( );
void computesum( );
int getcode( );
int gettotalscore( );
~Student( );
;
void Student::getinformation( )

//**2**
cout<<"英语成绩: " ;
cin>>english;
cout<<"计算机成绩: ";
cin>>computer;

void Student::computesum( )

total=english+computer;

[简答题]使用VC6打开考生文件夹下的工程RevPrroj7。此工程包含一个源程序文件 RevMain7.cpp。在该文件中,函数fun( )的功能是:逐个比较a、b两个字符串对应位置中的字符,把ASCII码值大或相等的字符依次存放到c数组中,形成一个新的字符串。例如:若a中的字符串为aBCDeFgH,b中的字符串为ABcd,则c中的字符串为 aBcdeFgH。
请改正程序中的错误,使它能得到正确结果。
注意,不要改动主函数,不得删行或增行,也不得更改程序的结构。
源程序文件RevMain7.cpp中的程序清单如下:
//RevMain7.cpp
#include<iostream>
#include<string>
using namespace std;
void fun(char *p,char *q,char *c)

int k=1;
while(*p!=*q)

if(*p<*q)
c[k]=*q;
else
c[k]=*p;
if(*p)
p++;
if(*q)
q++;


int main( )

char a[10]="aBCDeFgH",b[10]="ABcd",c[80]=’/0’;
fun(a,b,c);
cout<<"The string a is "<<a<<’/n’;
cout<<"The string b is "<<b<<’/n’;
cout<<"The string c is "<<c<<endl;
return 0;

[简答题]使用VC6打开考生文件夹下的工程RevProj10。此工程包含一个源程序文件RevMain10.cpp。在该文件中,函数fun的功能是:计算出数组x中的最小值与次最小值,并分别将其与x[0]、x[1]交换。
请改正程序中的错误,使它能得到正确结果。
注意,不要改动主函数,不得删行或增行,也不得更改程序的结构。
源程序文件RevMain10.cpp中的程序清单如下:
//RevMain10.cpp
#include <iostream>
using namespace std;
#define N 30
int fun(int *x, int n);
int main ( )

int h[N]=4,7, 6, 5, 1, 7,3, 8,0,2,3;
int i;
for (i=0; i<11; i++)
cout<<h [i] << " " ;
cout <<"/n";
fun(h, 11);
for (i=0; i<n; i++)
cout<<h [i]<<" ";
cout<<’ /n’;
return 0;

int fun(int *x, int n)

int i,t;
int a1=0, a2=0,min1=32767,min2=32676;
/* * * * *FOUND * * * * */
for(i=1;i<n;i++)

if (x [i]<min1)

min2=min1;
a2=a1;
min1=x [i];
a1=i;

else if (x [i] <min2)

[简答题]使用VC6打开考生文件夹下的工程RevProj11。此工程包含一个源程序文件RevMain11.cpp,但在源程序文件中有错误。请改正程序中的错误,使它能得到正确结果。
注意,不得删行或增行,也不得更改程序的结构。
源程序文件RevMainll.cpp中的程序清单如下:
//RevMainll.cpp
#include<iostream>
using namespace std;
class point

private:
const int color;
int x;
int y;
public:
point(int x,int y,int c)

this->x=x;
this->y=y;
color=c;

void show( )

cout<<"x="<<x<<",y="<<y<<",color="<<color<<end1;


int main( )

const point p(10,10,100);
p.show( );
return 0;

[简答题]使用VC6打开考生文件夹下的工程RevProj12。此工程包含一个源程序文件RevMain12.cpp,但在该程序中有错误。请改正程序中的错误,使它能得到正确结果。
注意:不得删行或增行,也不得更改程序的结构。
源程序文件RevMain12.cpp中的程序清单如下:
//RevMain12.cpp
#include<iostream>
/* * * * FOUND * * * * */
using namespace std;
class test

private:
const int value;
char dep[10];
public:
/* * * * *FOUND* * * * */
test( )

value=0;
strcpy(dep,"m");

/* * * * *FOUND* * * * */
test(int newvalue)

value=newvalue;
strcpy (dep, "m");

/* * * * *FOUND * * * * */
void show( )

cout<<"value= "<<value<<end1;

;
int main ( )

test t1;
const test t2;
t1.show ( );
t2.show( );
return 0;

[简答题]使用VC6打开考生文件夹下的工程RevProj3。此工程包含一个源程序文件 RevMain3.cpp。阅读文件中的程序代码,找出程序中的错误,并改正。
源程序文件RevMain3.cpp清单如下:
//RevMain3.cpp
#include<iostream>
using namespace std;
class MyClass
public:
/* * * * * * * * *found * * * * * * * * * */
void MyClass(int a) value=a;
int Max(int x,int y)

if(x>y)
return x>yx:y;
else
return y>valuey:value;

/* * * * * * * * *found * * * * * * * * * */
~MyClass(int a)

value=a;

private:
int value;

int main( )

MyClass my(10);
cout<<my.Max(20,30)<<end1;
return 0;

[简答题]使用VC6打开考生文件夹下的工程MyProj11。此工程包含一个源程序文件 MyMain11.cpp。程序中定义了3个类A、B和C,但类C的定义并不完整。 请按要求完成下列操作,将类的定义补充完成: ①类C是基类A和B公有派生来的。请在注释“//* *1* *”之后添加适当的语句。 ②完成构造函数C(int k)定义,采用初始化列表的方式使基类A私有成员a初始化为k-2,基类B的私有成员b初始化为k+2,类C的私有成员c初始化为k。请在注释“//* *2* *”之后添加适当的语句。 ③完成类Derived的成员函数disp( )的类体外的定义。函数disp( )中要分别显式调用基类A、B的disp( )函数,然后要输出私有成员c的值。请在注释“//* *3* *”之后添加适当的语句。 注意:除在指定位置添加语句之外,请不要改动程序中的其他内容。 源程序文件MyMain11.cpp清单如下; //MyMain11.cpp #include <iostream> using namespace std; class A { private: int a; public: A(int i) { a=i;} void disp( ) { cout<<a<<" , " } }; class B { private: int b; public: B(int j){ b=j;} disp ( ) { cout<<b<<", "; } }; //* * *1* * * { private: int c; public: //* * *2* * * void disp( ); }; void c::disp( ) { //* * *3* * * } int main ( ) { C obj(10); obj.d

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码