问答题使用VC6打开考生文件夹下的工程proj2。此工程包含一个源程序文件main2.cpp,但该程序运行有问题。请改正main函数中的错误。 源程序文件main2.cpp清单如下: //main2.cpp #include <iostream> using namespace std; class MyClass public: MyClass(int m) member=m; ~MyClass() int GetMember() return member; private: int member; ; MyClass MakeObject(int m) MyClass *pMyClass=new MyClass(m); return *pMyClass; int main ( ) int x=7; /************found**************/ MyClass *myObj=MakeObject(x); /*************found*************/ cout<<"My object has member"<<myObj.GetMember()<<end1; return 0;
问答题使用VC6打开考生文件夹下的源程序文件modi3.cpp,其中定义了用于表示雇员的Employee类,但类Employee的定义并不完整。请按要求完成下列操作,将类CEmployee的定义补充完成。
(1)定义私有数据成员name、street、city、zipcode和age分别用于表示姓名、街道、城市、邮编、年龄,除年龄是整型外其余都是char型的数据。请在注释∥********1********之后添加适当的语句。
(2)完成默认构造函数CEmployee的定义,使其把参数传递给私有数据成员name、street、city、zipcode和age。请在注释∥********2********之后添加适当的语句。
(3)完成成员函数alterName(char*newName)的定义。请在注释∥********3********之后添加适当的语句。
(4)完成成员函数IsEqual(char*ename)的定义,实现当name相等时返回真,否则为假的功能,请在注释∥********4********之后添加适当的语句。
注意:除在指定位置添加语句之外,请不要改动程序中的其他内容。
#include
#include
#deflne MAXLEN 20
class CEmployee
{
private:
∥********1********
int age;
public:
CEmployee (char*newName,
zhar *newStreet,char *newCt,
char*newZp,int newAge);
void alterName(char*newName);
void display();
bool IsEqual(char*ename);
};
CEmployee::CEmployee (char
*newName,char *newStreet,char
*newCt,char*newZp,int newAge)
{
∥********2********
age=newAge;
}
void CEmployee::alterName(char
*newName)
{
∥********3********
}
bool CEmployee::IsEqual (char*ename)
{
∥********4********
}
void CEmployee::display()
{
cout << name << “ ” <
问答题请使用VC6或使用【答题】菜单打开考生文件夹proj3下的工程proj3,其中声明IntSet是一个用于表示正整数集合的类。IntSet的成员函数Intersection的功能是求当前集合与另一个集合的交集。请完成成员函数Intersection。在main函数中给出了一组测试数据,此时程序的输出应该是: 求交集前: 1 2 3 5 8 10 2 8 9 11 30 56 67 求交集后: 1 2 3 5 8 10 2 8 9 11 30 56 67 2 8 要求: 补充编制的内容写在“//**********333**********”与“//**********666**********”之间,不得修改程序的其他部分。 注意:程序最后将结果输出到文件out.dat中。输出函数writeToFile已经编译为obj文件,并且在本程序中调用。//Intset.h#include<iostream>using namespace std;const int Max=100;ClaSS IntSet{public: IntSet()//构造一个空集合 { end=一1; } IntSet(int a[],int size)//构造一个包含数组a中size个元素的集合 { if(Size>=Max) end=Max一1; else end=Size一1; for(int i=0;i<=end;i++) element[i]=a[i]; } bool IsMemberOf(int a)//判断a是否为集合中的一个元素 { for(int i=0;i<=end;i++) if(element[i]==a) return true; return false; } int GetEnd(){return end;}//返回最后一个元素的下标 int GetElement(int i){return element[i];)//返回下标为i的元素 IntSet Intersection(IntSet&set);//求当前集合与集合set的交 void Print()//输出集合中的所有元素 { for(int i=0;i<=end;i++) if((i+1)%20==0) cout<<element[i]<<endl; else cout<<element[i]<<''; cout<<end1; }private: int element[Max]; int end; }; VOid writeToFile(const char*); //main.cpp #include”IntSet.h” IntSet IntSet::Intersection(IntSet& set) { int a[Max],size=0; //********333******* //********666******** return IntSet(a,size); } int main() { int a[]={1,2,3,5,8,i0}; int b[]={2,8,9,11,30,5 6,67); IntSet setl(a,6),set2(b,7),set3; cout<<”求交集前:”<<endl; set1.Print(); set2.Print(); set3.Print(); set3=setl.Intersection(set2); cout<<endl<<”求交集后:”<<end1; set1.Print(); set2.Print(); set3.Print(); wtiteToFile(””); return 0; }
问答题请使用VC6或使用【答题】菜单打开
proj2下的工程proj2,此工程包含有一个源程序文件proj2.cpp,其中定义了Stack类和ArrayStack类。
Stack是一个用于表示数据结构“栈”的类,栈中的元素是字符型数据。Stack为抽象类,它只定义了栈的用户接口,如下所示:
公有成员函数 功能
push 入栈:在栈顶位置添加—个元素
pop 退栈:取出并返回栈顶元素
ArrayStack是Stack的派生类,它实现了Stack定义的接口。ArrayStack内部使用动态分配的字符数组作为栈元素的存储空间。数据成员maxSize表示的是栈的最大容量,top用于记录栈顶的位置。成员函数push和pop分别实现具体的入栈和退栈操作。
请在程序中的横线处填写适当的代码,然后删除横线,以实现上述功能。此程序的正确输出结果应为:
a,b,c
c,b,a
注意:只在指定位置编写适当代码,不要改动程序中的其他内容,也不要删除或移动“// ****found****”。
// proj2.cpp
#include <iostream>
using namespace std;
class Stack {
public:
virtual void push(char c) = 0;
virtual char pop() = 0;
};
class ArrayStack : public Stack {
char * p;
int maxSize;
int top;
public:
ArrayStack(int s)
{
top = 0;
maxSize = s;
// ********found********
p =______;
}
~ArrayStack()
{
// ********found********
______;
}
void push (char c)
{
if (top == maxSize) {
cerr << "Overflow! /n";
return;
}
// ********found********
______;
top ++;
}
char pop()
{
if (top == 0) {
cerr << "Underflow! /n"; return "/0";
}
top --;
// ********found********
______;
}
};
void f(Stack
cout << ch[0] << "," << ch[1] << "," << ch[2] << endl;
sRef.push(ch[0]); sRef.push(ch[1]); sRef.push(ch[2]);
cout << sRef.pop() << ",";
cout << sRef.pop() << ",";
cout << sRef.pop() << endl;
}
int main()
{
ArrayStack as(10);
f(as);
return 0;
}
问答题请编写函数fun(),对长度为7个字符的字符串,除首、尾字符外,将其余5个字符按ASCII码值降序排列。 例如:原来的字符串为CEAedca,则排序后输出为CedcEAa。 注意:部分源程序已存在文件test22_2.cpp中。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。 文件test22_2.cpp的内容如下: #include <iostream.h> #include <stdio.h> #include <ctype.h> #include <conio.h> void int fun(char *s, int num) void main ( ) char s[10]; printf ("输入7个字符的字符串:"); gets(s); fun(s,7); cout<<s;
问答题使用VC6打开考生文件夹下的源程序文件modi3.cpp。其中定义的类并不完整,按要求完成下列操作,将类的定义补充完整。完成以下功能:
(1)定义复数类CComplex的私有成员变量real和imagmary,分别用来表示复数的实部和虚部,都是double类型的变量。请在注释, ∥********1********后添加适当的语句。
(2)添加复数类CComplex的带一个参数的构造函数,分别将real和imaginary赋值为参数r和0。请在注释∥********2********后添加适当的语句。
(3)完成对运算符“+”的重载,分别对复数的实部和虚部相加。请在注释∥********3********后添加适当的语句。
(4)完成复数的友元函数Equal(CComplex
imaginary=imag ;
}
friend bool Equal(CComplex
bool Equal(CComplex
CComplex complex2 ;
cout<
问答题编写函数fun(),它的功能是利用以下所示的简单迭代方法求方程cos(x)-x=0的一个实根。 Xn+1=COS(Xn) 迭代步骤如下: (1)取x1初值为0.0。 (2)x0=x1,把x1的值赋给x0。 (3)x1=cos(x0),求出一个新的x1。 (4)若x0-x1的绝对值小于0.000001,则执行步骤(5),否则执行步骤(2)。 (5)所求x1就是方程cos(x)-x=0的一个实根,作为函数值返回。 程序输出结果Root=0.739085。 注意:部分源程序已存在文件test6_2.cpp中。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。 文件test6_2的内容如下: #include<conio.h> #include<math.h> #include<iostream.h> float fun() { } void main() { cout<<"Root="<<fun()<<endl; }
问答题请使用VC6或使用【答题】菜单打开考生文件夹proj1下的工程pmj1,此工程中包含源程序文件main.cpp,其中有ElectricFan(“电风扇”)类和主函数main的定义。程序中位于每个“//ERROR****found****”之后的一行语句有错误,请加以改正。改正后程序的输出结果应该是:品牌:清风牌,电源:关,风速:0品牌:清风牌,电源:开,风速:3品牌:清风牌,电源:关,风速:0注意:只修改每个“//ERROR****found****”下的那一行,不要改动程序中的其他内容。#include<iOStream>usingnamespacestd;classElectricFan{//“电扇”类char*brand;intintensity;//风速:0一关机1一弱,2一中,3一强public:ElectricFan(constchar*thebrand):intensity(0){brand=newchar[strlen(thebrand)+1];strcpy(brand,thebrand);}~ElectricFan(){delete[]brand;}constchar。theBrand()const{returnbrand;}//返回电扇品牌inttheIntensity()const{returnintensity;}//返回风速//ERROR**********found**********boolisOn()const{returnintensity=0;}//返回电源开关状态//ERROR**********found**********voidturnOff()const{intensity=0;}//关电扇voidsetIntensity(intinten){//开电扇并设置风速if(inten>=1&&inten<=3)//ERROR**********found**********inten=intensity;}voidshow(){cout<<"品牌:"<<theBrand()<<"牌"<<",电源:"<<(isOn()?"开":"关")<<",风速:"<<theIntensity()<<end1; }};intmain(){ElectricFanfan(”清风”);fan.show();fan.setIntensity(3);fan.show();fan.turnOff();fan.show();return0;}
问答题请使用VC6或使用【答题】菜单打开
proj1下的工程proj1,该工程中含有一个源程序文件proj1.cpp。其中位于每个注释“// ERROR ****found****”之后的一行语句有错误。请改正这些错误,使程序的输出结果为:1 2 3 4 5 6 7 8 9 10
注意:只能修改注释“// ERROR ****found****”的下一行语句,不要改动程序中的其他内容。
// proj1.cpp
#include <iostream>
using namespace std;
class MyClass {
public:
MyClass(int len)
{
array = new int[len];
arraySize = len;
for (int i = 0; i < arraySize; i ++)
array[i] = i+1;
}
~MyClass()
{
// ERROR ********found********
delete array[i];
}
void Print() const
{
for (int i = 0; i < arraySize; i ++)
// ERROR ********found********
cin << array[i] <<";
cout << endl;
}
private:
int * array;
int arraySize;
};
int main()
{
// ERROR ********found********
MyClass obj;
obj.Print();
return 0;
}
问答题使用VC6打开考生文件夹下的源程序文件modi2.cpp。阅读下列函数说明和代码,补充空出的代码。函数IsPalindromes(cha*string)实现的功能是判定给定的字符串是否构成回文字符串,如果是则返回1,否则返回0。
如:1234554321或者1234321都认为是回文字符串。
如果串为空或一个字母时,均认为是回文字符串。
注意:不能修改程序的其他部分,只能补充
IsPalindromes()函数。
#include
#define MAXLEN 1024
bool IsPalindromes(char*string)
{
}
void main()
{
char Str[MAXLEN];
cout<<"请输入一行文字"<
问答题使用VC6打开考生文件夹下的源程序文件modi3.cpp。其中定义的类并不完整,按要求完成下列操作,将类的定义补充完整。
(1)完成默认构造函数TestClass的定义,使得TestClass对象的类型为int,默认值为a=0,b=0,c=0,请在注释∥********1********后添加适当的语句。
(2)定义类的私有成员变量,x、y、z类型为int,请在注释∥********2********后添加适当的语句。
(3)定义类TestClass的数据成员count声明为静态整数型数据成员,请在注释∥********3********后添加适当的语句。
(4)在构造函数中实现用count表示类TestClass被实现对象的次数。请在注释∥********4********后添加适当的语句。
本程序的输出结果为:
The point is(1,1,1)
There are 3 point objects
The point is(1,2,3)
There are 3 point objects
The point is(0,0,0)
There are 3 point objects
注意:除在指定的位置添加语句之外,请不要改动程序的其他部分。
#include
using namespace std;
C1ass TestClass
{
public:
∥********1********
{
X=a;
Y=b;
Z=c;
∥********4********
}
void Display()
{
cout<<“The point is {”
<
问答题请使用菜单命令或直接使用VC6打开
下的工程proj1。程序中位于每个//ERROR**********found**********下的语句行有错误,请加以更正,不得修改程序的其他部分。更正后程序的输出应该是:两点之间的距离为:7.5231
注意:只能修改每个//ERROR **********found**********下的那一行,不要改动程序中的其他内容。
#include <iostream>
#include<cmath>
using namespace std;
class Point{
private:
double x, y;
public:
Point(double xx, double yy){
x=xx;
y=yy;
}
//ERROR **********found**********
double MyDistance(Point
};
double MyDistance(Point
//ERROR **********found**********
double dy=a.y-y;
retum sqrt(dx*dx+dy*dy);
}
int main()
{
Point p1(3.6, 6.4), p2(8, 0.3);
double d=MyDistance(p1, p2);
cout<<“两点之间的距离为:”<<d<<endl;
return 0;
}
问答题请使用VC6或使用[答题]菜单打开考生文件夹proj1下的工程proj1,此工程中包含程序文件main.cpp,其中有ElectricFan(“电风扇”)类和主函数main的定义。程序中位于每个“//ERROR****found****”之后的一行语句有错误,请加以改正。改正后程序的输出结果应为:
品牌:清风牌,电源:关,风速:0
品牌:清风牌,电源:开,风速:3
品牌:清风牌,电源:关,风速:0
注意:只修改每个“//ERRO****found****”下的那一行,不要改动程序中的其他内容。
#include<iostream>
using namespace std;
class ElectricFan{ //"电扇"类
char * brand;
int intensity; //风速: 0-关机, 1-弱, 2-中, 3-强
public:
ElectricFan (const char * the_brand): intensity(0){
brand = new char [ strlen (the_brand) +1];
strcpy(brand, the_brand);
}
~ElectricFan() {delete []brand; }
//ERROR **********found**********
const char * theBrand()const{ return* brand;} //返回电扇品牌
int theIntensity () const { returnintensity; }
//返回风速
bool isOn()const{ return intensity>0;}
//ERROR **********found**********
void turnOff() { intensity=1; }
//关电扇
void setIntensity (int inten){
//ERROR **********found**********
if (intensity>=i
}
void show () {
cout<< "品牌:"<<theBrand () <<"牌"
<<",电源:" <<(isOn ()? "开":"关")
<<",风速:" <<theIntensity () <<endl;
}
};
int main() {
ElectricFan fan ("清风");
fan. show () ;
fan. setIntensity (3);
fan. show ();
fan. turnOff ();
fan. show ();
return 0;
}
问答题请使用VC6或使用[答题]菜单打开考生文件夹proj1下的工程proj1,该工程中含有一个源程序文件proj1.cpp。其中位于每个注释“//ERROR****found****”之后的一行语句有错误。请改正这些错误,使程序的输出结果为:1 2 3 4 5 6 7 8 9 10
注意:只能修改注释“//ERROR****found****”的下一行语句,不要改动程序中的其他内容。
//proj1.cpp
#include<iostream>
using namespace std;
class MyClass{
public:
MyClass(int len)
{
array=new int[len];
arraySize=len;
for(int i=0;i<arraySize;i++)
array[i]=i+1;
}
~MyClass()
{
//ERROR**********found**********
delete array[i];
}
void Print () const
{
for (int i=0; i<arraySize; i++)
//ERROR**********found**********
cin<<array[i]<<";
cout<<endl;
}
private:
int*array;
int arraySize;
};
int main ()
{
//ERROR**********found**********
MyClass obj;
obj.Print();
return 0;
}
问答题综合应用题
使用VC6打开考生文件夹下的工程kt14_3。此工程包含一个kt14_3.cpp,其中定义了二维坐标类Coordinate和三维坐标类ThreeDCoord,其中ThreeDCoord类由Coordinate类public派生,但两个类的定义并不完整。请按要求完成下列操作,将程序补充完整。
(1)定义类Coordinate的保护数据成员x和y,它们都是int型的数据,代表二维坐标的横纵坐标值。请在注释“//**1**”之后添加适当的语句。
(2)根据类Coordinate定义后的成员函数Display的实现,补充该函数在类Coordinate定义体内的声明,Display为二维坐标类的虚函数。请在注释“//**2**”之后添加适当的语句。
(3)完成二维坐标类Coordinate的构造函数,将参数a和b分别赋值给数据成员x和y。请在注释“//**3**”之后添加适当的语句。
(4)根据ThreeDCoord类构造函数的声明,补充ThreeDCoord构造函数的实现,参数a和b通过调用基类的构造函数来初始化基类的数据成员x和y,c赋值给数据成员z。请在注释“//**4**”之后添加适当的语句。
输出结果如下:
[1,2]
[3,4,5]
注意:除在指定位置添加语句之外,请不要改动程序中的其他内容。
源程序文件kt14_3.cpp清单如下:
#include
classCoordinate
{ protected:
//**1**
public:
Coordinate(inta=0,intb=0);
//**2** };
Coordinate::Coordinate(inta,intb)
{ //**3** }
voidCoordinate::Display()const
{ cout
classThreeDCoord:publicCoordinate
{ intz;
public:
ThreeDCoord(inta=0,intb=0,intc=0);
virtualvoidDisplay()const; };
//**4**
voidThreeDCoord::Display()const
{ cout
voidmain()
{ Coordinatec(1,2);
ThreeDCoordt(3,4,5);
c.Display();
t.Display(); }
问答题使用VC6打开考生文件夹下的源程序文件modi.cpp,该程序运行时有错误,请改正其中的错误,使得程序正确运行。
程序输出:
s1:n=20
s2:n=10
执行s3.add(s1,s2)
s3:n=30
s4:n=30
注意:不要改动main函数,不能增行或删行,也不能更改程序的结构,错误的语句在
∥********error********的下面。
#include
Class TestClass
{
int n;
public:
TestClass() {}
TestClass(int m)
{
n=m;
}
∥********error********
TestClass add(TestClass s1,s2)
{
this一>n=s1.n+S2.n;
∥********error********
return(this);
}
void di sp()
{
cout<<“n=”<
问答题使用VC6打开考生文件夹下的源程序文件modi3.cpp。其中定义的类并不完整,按要求完成下列操作,将类的定义补充完整。
(1)完成默认构造函数TestClass的定义,使得TestClass对象的类型为int,默认值为a=0,b=0,c=0,请在注释∥********1********后添加适当的语句。
(2)定义类的私有成员变量,X、Y、Z类型为int,请在注释∥********2********后添加适当的语句。
(3)定义类TestClass的数据成员count声明为静态整数型数据成员, 请在注释∥********3********后添加适当的语句。
(4)在构造函数中实现用count表示类TestClass被实现对象的次数。请在注释∥********4********后添加适当的语句。
本程序的输出结果为:
The point is(1,1,1)
There are 3 point objects
The point is(1,2,3)
There are 3 point objects
The point is(0,0,0)
There are 3 point objects
注意:除在指定的位置添加语句之外,请不要改动程序的其他部分。
#include
using namespace std;
C1ass TestClass
{
public:
∥********1********
{
X=a;
Y=b;
Z=c;
∥********4********
}
void Display()
{
cout<<“The poi nt i s (“<
问答题请使用菜单命令或直接用VC6打开
下的工程proj2,其中有元素类Element和集合类MySet的定义。请在程序中的横线处填写适当的代码,然后删除横线,以实现上述类定义。此程序的输出结果应为:
0 3 5 8
0 3 8
注意:只能在横线处填写适当的代码,不要改动程序中的其他内容,也不能删除或移动“//***********found***********”。
#include<iostream>
#include<cmath>
using namespace std;
#define MaxElement 100
class Element{ //“元素”类
public:
int n;
Element(int i=0):n(i) {}
};
class MySet{//“集合”类
Element*element; //指向存储元素的数组的指针
int size; //数组大小
int counter; //数组中元素的个数
int current; //用于表示扫描位置,及当前被扫描元素在数组中的下标
public:
MySet():element(new Element[100]), size(100), counter(0), current(0) {}
~MySet(){delete[]element;}
void add(Element ele); //向集合中添加一个元素,保持由小到大的顺序。
void remove(Element ele); //删除集合中指定的元素
void scanFirst(){current=0;}
//将扫描位置定位于首元素
//*********found********
void scanNext(){______;} //将扫描位置定位于下一个元素
Element get()eonst{return element[current];} //返回当前被扫描的元素
bool isEnded()const{return current>=counter;}//如果已经没有更多的元素可扫描了,返回true。
void show();//显示集合中所有元素
};
void MySet::add(Element ele){
int pos=counter; //pos用于确定元素应插入的位置
while(pos>0){ //从后往前寻找该位置
if(ele.n>element[pos-1].n)break; //找到应插入的位置,退出循环
//**********found**********
if(______) return; //发现相同元素,终止添加过程。
pos--;
if(counter>=size){ //如果没有足够空间,扩充空间(增加100个元素的容量)
Element*tmp=element; //tmp指向原来的数组
//**********found**********
element=______; //申请一个新的数组,容量扩大100个元素的容量
for(int i=0; i<size; i++) element[i]=tmp[i];
size+=100;
delete[]tmp;
}
for(int i=counter; i>pos; i--)element[i]=element[i-1]; //后移相关元素,腾出存放新元素的空间
element[pos]=ele; //插入新元素
counter++;
}
void MySet::show(){
scanFirst(); //扫描位置定位于首元素
while(!isEnded()){
cout<<get().n<<"";
//**********found**********
______; //扫描定位于下一个元素
}
cout<<endl;
}
void MySet::remove(Element ele){
int pos=counter-1; //pos用于确定要删除的元素的位置
while(pos>=0){ //从后往前寻找该位置
if(ele.n>element[pos].n) return; //集合中没有该元素,终止删除过程。
if(ele.n==element[pos].n)break; //找到删除的元素,退出循环。
pos--;
}
if(pos<0)return; //集合中没有该元素,终止删除过程。
for(int i=pos; i<counter-1; i++) element[i]=element[i+1]; //删除该元素,后面的元素顺序前移。
counter--;
if(counter+100<=size){//如果来使用的存储单元超过100,缩减存储空间,减少100个单元
Element*tmp=element;
element=new Element[size-100];
for(int i=0; i<size; i++) element[i]=tmp[i];
size-=100:
delete[]tmp;
}
}
int main(){
MySet set;
set.add(Element(3));
set.add(Element(8));
set.add(Element(5));
set.add(Element(0));
set.show();
set.remove(Element(5));
set.remove(Element(4));
set.add(Element(8));
set.show();
return 0;
}
问答题请使用VC6或使用【答题】菜单打开考生文件夹proj3下的工程proj3,其中声明的CDeepCopy是一个用于表示动态数组的类。请编写其中的复制构造函数。要求:补充编制的内容写在“//**********333**********”与“//**********666**********”之间,不得修改程序的其他部分。注意:程序最后将结果输出到文件out.dat中。输出函数writeToFile已经编译为obj文件,并且在本程序中调用。//CDeepCopy.h#include<iostream>#include<string>usingnamespacestd;classCDeepCopy{public:intn;//动态数组的元素个数int*p;//动态数组首地址CDeepCopy(int);~CDeepCopy();CDeepCopy(constCDeepCopy&r);//复制构造函数};voidwriteToFile(char*);//main.cpp#include"CDeepCopy.h"CDeepCopy::~CDeepCopy(){delete[]p;}CDeepCopy::CDeepCopy(intk){n=k;p=newint[n];}//构造函数实现CDeepCopy::CDeepCopy(constCDeepCopy&r)//复制构造函数{//********333********//********666********}intmain(){CDeepCopya(2),d(3);a.P[0]=1;d.P[0]=666;//对象a,d数组元素的赋值{CDeepCopyb(a);a.P[0]=88;cout<<b.P[0];//显示内层局部对象的数组元素}cout<<d.P[0];//显示d数组元素a.P[0]的值cout<<"dfadeaway;\n";tout<<a.p[0];//显示a数组元素a.P[0]的值writeToFile("");return0;}
问答题使用VC6打开考生文件夹下的源程序文件modi2.cpp。完成fun()函数,其功能是:将两个从小到大有序数组a和b,复制合并出一个有序整数序列C,其中形参n和m分别是数组a和b的元素个数。注意:不能修改程序的其他部分,只能修改fun()函数。#include(iostream.h>void fun (int a[],int n,intb[],int m,int*c){}void main(){ int A[]={3,5,7,9,II,18,21}, int B[]={6,15,19,21,3 9); int C[25],i ; for(i=0;i<2 5 ; i++)C[i]=0, cout<<”A[]=”; for(i=0;i<7 ; i++) cout<
