网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
问答题
使用VC6打开考生文件夹下的源程序文件modi1.cpp,该程序运行时有错,请改正其中的错误,使程序正常运行,并使程序输出的结果为:  Max is 7  提示:max()函数实现找出两个数中的最大值,并作为函数值返回。  注意:错误的语句在∥******error******的下面,修改该语句即可。

参考答案

参考解析
解析: 暂无解析
更多 “问答题使用VC6打开考生文件夹下的源程序文件modi1.cpp,该程序运行时有错,请改正其中的错误,使程序正常运行,并使程序输出的结果为:  Max is 7  提示:max()函数实现找出两个数中的最大值,并作为函数值返回。  注意:错误的语句在∥******error******的下面,修改该语句即可。” 相关考题
考题 考生文件夹下有一个数据库“学校管理”,其中有数据库表“student”、“score”和“course”(1)在考生文件夹下有程序文件“cxl.prg”,该程序的功能是检索分数小于60的学生的全部信息。请修改程序中的错误,并调试该程序,使之正确运行。考生不得增加或删减代码。(2)编写程序“cx2.prg”,实现“输入一个数判断其是否为素数”的功能。

考题 使用VC6打开考生文件夹下的工程test28_1,此工程包含一个源程序文件test28_1.cpp,但该程序运行有问题,请改正程序中的错误,使该程序的输出结果为:55源程序文件test28_1.cpp清单如下:include <iostream.h>class A{public:/***************** found *****************static int n=1;A(){n++;};~A() (n--;};};/***************** found *****************int n=0;int main() {A a;A b[3];A *c=new A;c=a;/***************** found *****************cout<<c.n<<end1;cout<<A::n<<end1;return 0;}

考题 使用VC6打开考生文件夹下的工程RevProj12。此工程包含一个源程序文件RevMain12.cpp,但在该程序中有错误。请改正程序中的错误,使它能得到正确结果。注意:不得删行或增行,也不得更改程序的结构。源程序文件RevMain12.cpp中的程序清单如下://RevMain12.cppinclude<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;}

考题 使用VC++6.0打开考生文件夹下的源程序文件1.cpp,该程序运行时有错误,请改正错误,使得程序输出: Hello test 注意:不要改动main函数,不能增加或删除行,也不能更改程序的结构,错误的语句在 //******error******的下面。 试题程序: includeiostream //********error******** templateT voidfun(Tt) { std::cout"test"std::endl; } //********error******** templatebool voidfun(boolt) { std::cout(t?"Hell0":"Hi")std::endl; } intmain { //********error******** boolflag=TRUE; fun(flag); fun((int)flag); return0; }

考题 使用VC6打开考生文件夹下的工程ms9_1,此工程包含一个源程序文件test9_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下:4,520源程序文件test9_1.cpp清单如下:include<iostream.h>class A{protected:int n,m;public:void set(int a,int b){m=a; n=b;)void show(){cout<<m<<","<<n<<endl;)/**********found*********/}class B:public A{int s;public:void set(){s=m*n;)void shows(){cout<<s<<endl;)};void main(){B b;/**********found**+******/b.set();b.show();b.set();/*********found**********/b.show();}

考题 使用VC6打开考生文件夹下的工程test11_1,此工程包含一个源程序文件test11_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下:ch1=7 ch2=9源程序文件test11_1.cpp清单如下:include<iostream.h>class Sample{/**************** found ***************/char ch1,ch2public:/************** found ***************/friend void set(Sample s, char c1,char c2){s.ch1=c1;s.ch2=c2;}void print() {cout<<"ch1="<<" ch2="<<ch2<<end1;}};void main(){Sample obj;/************* found ****************/obj.set(obj,'7','9');obj.print();}

考题 使用VC++6.0打开考生文件夹下的源程序文件1.cpp,但该程序运行有问题,请改正main函数中的错误,使该程序的输出结果正确。 程序输出: 8 8 注意:错误的语句在/********error********/的下面。修改该语句即可,其他的语句不能修改。 试题程序: include(iostream.h classCO { public: /********error********/ staticintn=0: CO { n++: } ~CO { n--: } }: /********error********/ intCO::n; voidmain { COobj; COobj2[7]; CO*C=NULL: c=&obj: /********error********/ eoutC.nendl; coutC0::nendl; }

考题 使用VC++6.0打开考生文件夹下的源程序文件1.cpp,该程序运行时有错。请改正程序中的错误,使程序输出的结果为 100 37 32 注意:错误的语句在//******error******的下面,修改该语句即可。 试题程序: includeiostream.h //******error****** voidmain { //******error****** intm=0142: //******error****** intn=0X27: intq=32; coutmendl; coutnendl; coutqendl; return; }

考题 使用VC++6.0打开考生文件夹下的源程序文件1.cpp,该程序运行时有错误,请改正错误,使程序正常运行,并且要求最后一个catch必须抛出执行的任何异常。程序异常,输出信息为errorOERROR注意:不要改动main函数,不能增加或删除行,也不能更改程序的结构,错误的语句在//******error******的下面。试题程序:includeiostream.h)intmain{try{throw(error);}//********error********catch(chars){coutsendl;}try{throw((int)0);}//********error********catch{coutiendl;}try{throw(O);throw(error);}//********error********catch{coutERRORendl;}return0;}

考题 使用VC6打开考生文件夹下的工程RevProj7。此工程包含一个源程序文件RevMain6.cpp,但该程序运行有问题。请改正主函数中的错误,使程序的输出结果是:MyNumber=0MyNumber=1MyNumber=2源程序文件RevMain6.cpp清单如下://RevMain6.cppinclude<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打开考生文件夹下的工程test42_1,此工程包含一个源程序文件test42_1.cpp,但该程序运行有问题,请改正函数中的错误,使该程序的输出结果为:rect area: 12rectb area: 30源程序文件test42_1.cpp清单如下:include <iostream.h>class CRectangle{/***************** found *****************/int *width, height;public:CRectangle (int,int);~CRectangle ();int area (void) {return (*width * *height);}};CRectangle::CRectangle (int a, int b){width = new int;height = new int;/***************** found *****************/width = a;*height = b;}CRectangle::~CRectangle (){delete width;delete height;}/***************** found *****************/void main (){CRectangle rect (3,4), rectb (5,6);cout << "rect area: "<< rect.area() << endl;cout << "rectb area: "<< rectb.area() << endl;return 0;}

考题 使用VC6打开老考生文件夹下的工程test5_1,此工程包含一个源程序文件test5_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下:x=3 y=5 z=08源程序文件test5_1.cpp清单如下:include<iostream.h>static int x=5;int z=0;int *add(int x,int y){cout<<"X="<<X<<"y="<<y<<" Z="<<z<<endl;z=z+x+y;/********found*********/return z;/********found*********/};void main(){int y=5;int x=3;/*********found********/cout<<(add(X,y))<<endl;}

考题 使用VC6打开考生文件夹下的工程test40_1,此工程包含一个源程序文件test40_1.cpp,但该程序运行有问题,请改正函数中的错误,使该程序的输出结果为:The first result is 5The second result is 2The third result is 2The fourth result is 6源程序文件test40_1.cpp清单如下:include <iostream.h>int subtraction (int a, int b){int r;r=a-b;/***************** found ************************/return r;}int main (){int x=5, y=3, z;z = subtraction (7,2);cout << "The first result is "<< z << '\n';cout << "The second result is "<< subtraction(7,subtraction (7,2)) << '\n';/**************** found *************************/cout << "The third result is "<< subtraction (x,y) << '\n';/***************** found ************************/z= 4 + *subtraction (x,y);cout << "The fourth result is "<< z << '\n';return 0;}

考题 使用VC6打开考生文件夹下的工程test30_1,此工程包含一个源程序文件test30_1.cpp,但该程序运行有问题,请改正程序中的错误,使该程序的输出结果为:Previous=9,Next=11源程序文件test30_1.cpp清单如下:include <iostream.h>/***************** found *****************/void prevnext (int,int ,int);int main ( ){int x=10,y,z;prevnext (x,y,z);cout << "Previous=" << y << ", Next=" << z<<end1;return 0;}/***************** found *****************/void prevnext (int x, int prev, int next){/***************** found *****************/prev=x--;next=++x;}

考题 使用VC6打开考生文件夹下的工程test29_1,此工程包含一个源程序文件test29_1.cpp,但该程序运行有问题,请改正程序中的错误,使该程序的输出结果为:A:no parametersB:int parameterA:no parametersB:int parameterC:int parameter源程序文件test29_1.cpp清单如下;include <iostream.h>class A{/***************** found *****************/private:A(){ cout<<"A:no parameters\n";}A(int a) {cout<<"A: int parameter\n";}};class B:public A{public:B(int a){cout<<"B:int Parameter\n";}};/***************** found *****************/class C:public B,public A{public:/***************** found *****************/C(int a) ::B(a) {cout<<"C: int parameter\n"; )};void main ( ){B b(1);C c(2);}

考题 使用VC6打开考生文件夹下的工程test26_1,此工程包含一个源程序文件test26_1.cpp,但该程序运行有问题,请改正函数中的错误,使该程序的输出结果为:Values are: 1,2 and 3源程序文件test26_1.cpp清单如下;include <iostream.h>class CommonBase{public:int x;};/*****************found*****************/class DeriveCommonA::public CommonBase{public:int y;};class DeriveCommonB:public CommonBase{public:int z;};/*****************found*****************/class Overlapping:public DeriveCommonA; public DeriveCommonB{public:void Display(){cout<<"Values are: "<<DeriveCommonA::x<<", "<<y<<" and "<<z<<end1;}};int main ( ){Overlapping ov;/*****************found*****************/ov.x=1;ov.y=2;ov.z=3;ov.Display();return 0;}

考题 使用VC6打开考生文件夹下的工程proj2。此工程包含一个源程序文件main2.cpp,但该程序运行有问题。请改正main函数中的错误。源程序文件main2.cpp清单如下://main2.cppinclude <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打开考生文件夹下的工程test21_1,此工程包含一个源程序文件test21_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下:The grade is 3源程序文件test21_1.cpp清单如下:include<iostream.h>class student{private:int grade;public:/**************** found*******************/student(int thegra):(thegra){}~student(){}int get_grade(){return grade;}};void main(){int thegra=3;/**************** found*******************/student point=new student(thegra);/**************** found*******************/cout<<"The grade is"<<point.get_grade()<<endl;delete point;}

考题 使用VC6打开考生文件夹下的工程test36_1,此工程包含一个源程序文件test36_1.cpp,但该程序运行有问题,请改正函数中的错误,使该程序的输出结果为:2源程序文件test36_1.cpp清单如下:include<iostream.h>class amount;class coins{/***************** found *****************/enum units {penny, nickel, dime, quarter, half_dollar}/***************** found *****************/class amount;};class amount{/***************** found *****************/coins:units money;public:void setm();int germ();};void amount::setm(){money = coins::dime;}int amount::getm(){return money;}int main ( ){amount ob;ob.setm();cout << ob.getm()<<end1;return 0;}

考题 使用VC6打开考生文件夹下的工程RevProj15。此工程包含一个源程序文件RevMain15.cpp,但该程序中类的定义有错误。请改正程序中的错误,使它能得到正确结果。注意,不要改动主函数,不得删行或增行,也不得更改程序的结构。源程序文件RevMain15.cpp中的程序清单如下://RevMain15.cppinclude<iostream>using namespace std;class Sample{private:int x;static int y;public:Sample(int a){x=a;y+=x;}static void print(Sample s){cout<<"x="<<x<<",y="<<y<<end1;}Sample::y=5;int main(){Sampel s1(10);Sample s2(15);Sample::print(s1);Sample::print(s2);return 0;}

考题 使用VC6打开考生文件夹下的工程test35_1,此工程包含一个源程序文件test35_1.cpp,但该程序运行有问题,请改正程序中的错误,使该程序的输出结果为:40040源程序文件test35_1.cpp清单如下:include <iostream.h>class Student{public:Student(int xx){x=xx;}virtual float calcTuition();/***************** found *****************/private:int x;};float Student::calcTuition(){return float(x'x);}/***************** found *****************/class GraduateStudent::public Student{public:/***************** found *****************/GraduateStudent(int xx) ::Student(xx){}virtual float calcTuition();};float GraduateStudent::calcTuition(){return float(x*2);}void main(){Student s(20);GraduateStudent gs(20);cout<<s.calcTuition()<<end1;cout<<gs.calcTuition()<<end1;}

考题 使用VC++6.0打开考生文件夹下的源程序文件1.cpp,该程序运行时有错误,请改正其中的错误,使程序正确运行,并且使程序输出的结果为 0K 注意:错误的语句在//******error******的下面,修改该语句即可。 试题程序: includeiostream.h classTC { public: TC { a=b=0: } private: inta,b; }; classTCl:publicTC { public: TC1 { } //******error****** virtualvoidfunc; }; classTC2:publicTCl { public: TC2 { a=0: b=0: } voidfunc { //******error****** cout"OK"endl; } private: inta; intb; }; voidmain { TC20bj; //******error****** TCl*p=(TCl*)obj; p-func; }

考题 问答题使用VC6打开考生文件夹下的源程序文件modil.cpp,该程序运行时有错误,请改正其中的错误,使程序正确运行。并且使程序输出的结果为:  OK  注意:错误的语句在//********error********的下面,修改该语句即可。

考题 问答题使用VC6打开考生文件夹下的源程序文件modil.cpp,该程序运行时有错误,请改正程序中的错误,使得程序输出:  1,2,3,4,5,  注意:不要改动main函数,不能增行或删行,也不能更改程序的结构,错误的语句在//******error******的下面。

考题 问答题使用VC6打开考生文件夹下的源程序文件modil.cpp,该程序运行时有错误,请改正其中的错误,使程序正常运行,并且输出以下结果:  4,5.  7,8  4,8.  注意:错误的语句在//******error******的下面,修改该语句即可。

考题 问答题使用VC6打开考生文件夹下的源程序文件modi1.cpp,该程序运行时有错误,请改正程序中的错误,使得程序输出:  number1=4.8 number2=93.6 number3=0.9  PRODUCT=404.352  注意:错误的语句在∥******error******的下面。修改该语句即可。其他的语句不能修改。

考题 问答题使用VC6打开考生文件夹下的源程序文件modil.cpp,该程序运行时有错误,请改正程序中的错误。  本题的功能是:从键盘输入字符串s,然后输出字符串s中的字符个数。  注意:不要改动main函数,不能增行或删行,也不能更改程序的结构,错误的语句在//******error******的下面。