计算机类
公务员类
工程类
语言类
金融会计类
计算机类
医学类
研究生类
专业技术资格
职业技能资格
学历类
党建思政类
计算机等级考试(NCRE)
全国计算机应用水平考试(NIT)
计算机软件水平考试
计算机等级考试(NCRE)
全国高校计算机等级考试CCT
行业认证
信息素养
计算机等级考试二级
计算机等级考试一级
网络工程师(计算机等级考试四级)
计算机等级考试二级
数据库工程师(计算机等级考试四级)
计算机等级考试三级
信息安全工程师(计算机等级考试四级)
嵌入式系统开发工程师(计算机等级考试四级)
软件测试工程师(计算机等级考试四级)
C++语言程序设计
Python语言程序设计
WPS Office高级应用与设计
C语言程序设计
C++语言程序设计
Java语言程序设计
Visual Basic语言程序设计
Web程序设计
Access数据库程序设计
MySQL数据库程序设计
Visual FoxPro数据库程序设计
办公软件高级应用
问答题使用VC6打开考生文件夹下的工程test13_3。此工程包含一个test13_.cpp,其中定义了类Vector,但类的定义并不完整。请按要求完成下列操作,将程序补充完整。 (1)完成构造函数的定义,把数据成员size初始化为参数s的值,数据成员buffer指向动态申请的int型size大小的空间。请在注释“//**1**”之后添加适当的语句。 (2)完成拷贝构造函数的定义,注意解决多次删除的问题。请在注释“//**2**”之后添加适当的语句。 (3)完成成员函数elem的定义,该函数返回buffer的第ndx个元素的值,注意如果ndx超界,请输出“error in index”。请在注释“//**3**”之后添加适当的语句。 (4)完成析构函数的定义,要求先将字符d打印在屏幕上,再释放buffer指向的空间。请在注释“//**4**”之后添加适当的语句。 输出结果如下: 1234567891012345678910dd 注意:除在指定的位置添加语句外,请不要改动程序中的其他语句。 源程序文件test13_3清单如下: #include<iostream.h> #include<stdlib.h> class Vector { public: Vector(int s=100); Vector(Vector &v); int &elem(int ndx); void display(); void set(); ~Vector(); protected: int size; int *buffer; }; Vector::Vector(int s) { // ** 1 ** } Vector::Vector(Vector &v) { // ** 2 ** for(int i=0; i<size; i++) { *(buffer+i)=*(v.buffer+i); } } int &Vector::elem(int ndx) { // ** 3 ** { cout<<"error in index"<<endl; exit(1); } return buffer[ndx]; } void Vector::display() { for(int j=0;j<size;j++) cout<<elem(i)<<endl; } void Vector::set() { for(int j=0;i<size;j++) elem(j)=j+1; } Vector::~Vector() { // ** 4 ** } void main() { Vector a(10); Vector b(a); a. set(); b. set(); a. display(); b. display(); }
进入题库练习
问答题请使用[答题]菜单命令或直接用VC6打开考生文件夹下的工程prog3,其中声明了ValArray类,该类在内部维护一个动态分配的整型数组。ValArray类的复制构造函数应实现对象的深层复制。请编写ValArray类的复制构造函数。在main函数中给出了一组测试数据,此种情况下程序的输出应该是: ValArray v1={1,2,3,4,5} ValArray v2={1,2,3,4,5} 要求: 补充编制的内容写在“//********333********”与“//********666********”之间,不得修改程序的其他部分。 注意:程序最后将结果输出到文件out.dat中。输出函数writeToFile已经编译为boj文件,并且在本程序中调用。 //ValArray.h #include<iostream> using namespace std; class ValArray{ int*v; int size; public: ValArray(const int*p, int n); siZe(n) { v=new int[size]; for(int i=0; i<size; i++) v[i]=p[i]; } VaiArray(const ValArray ~ValArray() {delete[]v;) void print(ostream for(int i=0; i<size-1; i++) out<<v[i] <<","; out<<v[size-1]<<'}'; } void setArray(int i, int val) { v[i]=val; } }; void writeToFile(const char*); //main.cpp #include"ValArray.h" ValArray::ValArray(const ValArray ValArray vl(a, 5); cout<<"ValArray v1="; v1.print(cout); cout<<endl; ValArray v2(v1); cout<<"ValArray v2="; v2.print(cout); cout<<endl; writeToFile(""); return 0; }
进入题库练习
问答题使用VC6打开下的源程序文件modi1.cpp,请修改程序中的错误,使程序能得出正确的结果:num:0num:1num:10注意:不要改动main函数,不能增行或删行,也不能更改程序的结构,错误的语句在//******error******的下面。#include<iostream.h>inti=10;classTestClass{public:TestClass(inti){//******error******i=i+1;}voidPrint()const{}private:inti;};voidmain(){//********error********TestClassprint;inti(0);print.Print();//********error********return;}
进入题库练习
问答题使用VC6打开考生文件夹下的工程RevProj14。此工程包含一个源程序文件RevMain14.cpp,但该程序中类的定义有错误。请改正程序中的错误,使它能得到正确结果。 注意,不要改动main函数,不得删行或增行,也不得更改程序的结构。 源程序文件RevMain14.cpp中的程序清单如下: //RevMain14.cpp #include<iostream> #include<math> using namespace std; class Point private: double x; double y; public: Point() void Point(double x1,double y1) x=x1; y=y1; void setvalue(double x,double y) x=x; y=y; double getx () return x; double gety() return y; void print() cout<<"x="<<x<<",y= "<<y<<end1; ~Point() ; class Line private: Point p1; Point p2; double width; public: Line(double x1,double y1,double x2,double y2,double d) :p1(x1,y1),p2(x2,y2) width=d; ~Line() void displength() double 1; 1=sqrt((p1.getx)-p2.getx())*(p1.getx()-p2-getx())+ (p1.gety()-p2.gety())*(p1.gety()-p2.gety())); cout<<"the length of Line is "<<1<<end1; ; int main() Line *p1; Line 1(5,15,25,35,0.5); p1= p1->displength(); return 0;
进入题库练习
问答题请使用VC6或使用【答题】菜单打开考生文件夹proj1下的工程proj1。程序中位于每个“//ERROR****found****”之后的一行语句有错误,请加以改正。改正后程序的输出结果应为: Name:Smith Age:21 ID:99999 CourseNum:12 Record:970 注意:只修改每个“//ERROR****found****”下的那一行,不要改动程序中的其他内容。 #include<iostream> using namespace std; class Studentlnfo { protected: //ERROR**********found********** char Name; int Age; int ID; int CourseNum; float Record; public: Studentlnfo(char*nanle,int Age,int ID,int courseNum,float record); //FRROR**********found********** void ~Studentlnfo(){} float AverageRecord(){ return Record/CourseNum; } void show()const{ cout<<"Name:"<<Name<<"Age:"<<Age<<"ID:"<<ID <<"CourseNum:"<<CourseNum<<"Record:"<<Record<<endl; } }; //ERROR**********found********** Studentlnfo Studentlnfo(char * Name,int Age,int ID,int CourseNum,float Record) { Name=name; Age=age; this->ID=ID; CourseNum=courseNum; Record=record; } int main() { Studentlnfo st("Smith",21,99999,12,970); st.show(); return 0; }
进入题库练习
问答题使用VC6打开考生文件夹下的源程序文件modil.cpp,但该程序运行时有错,请改正main()函数中的错误,使程序的输出结果如下: Constructor. Default constructor. Area is 12 Area is 0 Area is 12 注意:错误的语句在//*****error******的下面,修改该语句即可。#include<iostream.h>class CRectangle{private:double length,width;public: CRectangle() { cout<<"Default constructor.\n"; } CRectangle(double 1,double w) { length=1;width=w; cout<<"Constructor .\n"; } void Set(double 1,double w) { this->length=1; this->width=w; } void GetArea() { cout<<"Area is"<<length*width<<end1; } } void main() { CRectangle Rect1(3.0,4.0); //*****error****** CRectangle Rect2(1); //*****error****** Rect1.GetArea(); //*****error****** Rect2.Set(0); Rect2.GetArea(); Rect3.GetArea(); }
进入题库练习
问答题使用VC6打开考生文件夹下的源程序文件modi3.cpp。类Person完成对人的姓名和年龄的绑定。函数fun()获得年龄比较大的姓名。然后输出这个姓名到屏幕。 其中定义的类并不完整,按要求完成下列操作,将类的定义补充完整。 (1)完成类的构造函数,请在注释//********1********后添加适当的语句。 (2)完成构造函数对姓名的赋值,请在注释//********2********后添加适当的语句。 (3)定义类的友元函数fun(),请在注释//********3********后添加适当的语句。 (4)补充函数fun()的年龄比较,请在注释//********4********后添加适当的语句。 注意:增加代码,或者修改代码的位置已经用符号表示出来。请不要修改其他的程序代码。#include<iostream.h>Class Person{public://********1******** { int i; for(i=0;sUserrName[i]!=0;i++) { m UserName[i]=sUserrName[i]; )//********2******** m_Old=nOld; }private: char m_UserName[32]; int m_Old;//********3********};void fun(char* s,Person&personl,Person&person2){//********4******** if( ) { for(int i=0;personl.m_UserName[i]!=0;i++) { S[i] =personl.m_UserName[i]; S[i+1]=0; } } else { for(int i=0;person2.m_UserName[i]!=0;i++) { S[i] =person2.m_UserName[i]; S[i+1]=0; } }}void main(){ char S[32]; Person p1("abc",20); Person p2("def",30); fun(s,p1,p2); cout<<s<<end1; return;}
进入题库练习
问答题使用VC6打开考生文件夹下的源程序文件modi3.cpp。其中定义的类并不完整,按要求完成下列操作,将类的定义补充完整。(1)对文件以追加的方式打开文件。请在注释∥********1********后添加适当的语句。(2)定义m、n为类TestClass的公有int型数据成员,请在注释∥********2********后添加适当的语句。(3)定义P为类TestClass的数据成员指针,并指向类TestClass数据成员m,请在注释∥********3********后添加适当的语句。(4)定义P指向类TestClass数据成员n,请在注释//料料料料4料料料料后添加适当的语句。注意:增加代码,或者修改代码的位置已经用符号表示出来。请不要修改其他的程序代码。#include<iostream.h>#include<fstream>#include<iomanip>#include<cmath>us ing namespace std;void WriteFile(int X){ofstream outl ;∥********1********outl.open(”modi3.txt”, );outl<<X<<'.'outl.close();}void ClearFile(){ofstream outl ;outl.open(”modi3.txt”);outl.Close();}class TestClass{public:void disp(){cout(<¨m=¨<<m<<endl;WriteFile(m);cout<<”n=”<<n<<endl;WriteFile(n);}∥********2********};void main(){∥********3********ClearFile();TestClass a;a.*p=3 0;∥********4********a.*p=4 5 ;a.disp();}
进入题库练习
问答题请使用”答题”菜单或使用VC6打开考生文件夹proj2下的工程proj2,本程序中有两个类:一是日期类(Date),用于表示一天的日期(年、月、日);另一个是截止日期类(Dead.1ine),用于表示一个任务的截止日期,超过该日期即为超时。Deadline类中有Date类的数据成员。这里对Deadline类的数据成员和成员函数做一下说明:int id;//截止日期的idDate end—date;//截止日期,表示允许完成该任务的最后一天 void finish(Date date);//date未超过截止日期时,输出”Finished!”,否则输出”Time out.” bool check(Date date);//date未超过截止日期时返回true,否则返回false。 程序正确情况下输出: Finished! Time out.注意:只能在横线处填写适当的代码,不要改动程序中的其他内容,也不能删除或移动“//**********found**********”。#include<iOStream>using namespace std;class Date(private:int year;int month;int day.of month;public:Date(int Y,int m,int d){this一>year=Y;.this一>month:m;this一>day Of month=d;}bool operator<=(Date&dt)const {if(this一>year<dt.year lI(this一>year==dt.year&&this一>month<dt.month)I I(this一>year==dt.year&&this一>month==dt.month&&this一>day—of—month<=dt.day_of_month))//**********found**********};return false;}};class Deadline{private:int id;Date end date;public:Deadline(int id,int year,int month,int day_of_month)//**********found**********{this一>id=id;}void finish(Date date){if(check(date))//**********found**********cout<<<<endl;elsecout<<”Time out.”<<endl;)bool check(Date date){// **********found**********return——;:}};int main(){Deadline * d1=new Deadline(1,2014,3,12);Deadline*d2=new Deadline(2,2013,12,20);Date current time(2 01 4,1,1);dl一>finish(current time);d2一>finish(current time);delete d1,delete d2;return 0;}
进入题库练习
问答题使用VC6打开考生文件夹下的工程test41_3。此工程包含一个test41_3.cpp,其中定义了类Rectangle,但该类的定义并不完整。请按要求完成下列操作,将程序补充完整。 (1)定义类Rectangle的私有数据成员left,top和fight,bottom,它们都是int型的数据。请在注释“//**1**”之后添加适当的语句。 (2)添加类Rectangle的带四个int型参数1、t、r、b的构造函数的声明,并使这四个参数的默认值均为0,请在注释“//**2**”之后添加适当的语句。 (3)添加类Rectangle的成员函数SetTop()参数为int型的t,作用为把t的值赋给类的数据成员top,添加类Rectangle的成员函数SetBottom()参数为int型的t,作用为把t的值赋给类的数据成员bottom,请在注释“//**3**”之后添加适当的语句。 (4)完成派生类Rectangle的成员函数Show()的定义,使其以格式“right-bottom point is(right,bottom)”输出,请在注释“//**4**”之后添加适当的语句。 源程序文件test41_3.cpp清单如下: #include <iostream.h> class Rectangle // ** 1 ** int right, bottom; public: // ** 2 ** ~ Rectangle(); void Assign(int 1, int t, int r, int b); void SetLeft(int t)left = t; void SetRight(int t)right = t; // ** 3 ** void SetBottom(int t)bottom = t; void Show(); ; Rectangle::Rectangle(int 1, int t, int r, int b) left = 1; top = t; right = r; bottom = b; void Rectangle::Assign(int 1, int t, int r, int b) left = 1; top = t; right = r; bottom = b; void Rectangle::Show() cout<<"left-top point is ("<<left<<","<<top<<")"<<'/n'; // ** 4 ** void main() Rectangle rect; rect.Show(); rect.Assign(100,200,300,400); rect.Show();
进入题库练习
问答题使用VC++6.0打开 下的源程序文件1.cpp,该程序运行时有错误,请改正错误,使得程序通过运行。 程序输出结果为: 5 a 1 注意:不要改动main函数,不能增加或删除行,也不能更改程序的结构,错误的语句在//******error******的下面。 试题程序: #include<iostream> template<class T> //********error******** t min(t x,t y) { return (x>y) ? y:x; } void main() { int n=5; //********error******** char c="a"; int d=1; //********error******** cout<<min(n,n)<< endl; cout<<min(c,c)<<endl; cout<<min(d,d)<<endl; }
进入题库练习
问答题请使用VC6或使用【答题】菜单打开考生文件夹proj1下的工程proj1,此工程中包含程序文件main.cpp,其中有ElectricFan(“电风扇”)类和主函数main的定义。程序中位于每个“//ERROR****found****”之后的一行语句有错误,请加以改正。改正后程序的输出结果应为: 品牌:清风牌,电源:关,风速:0 品牌:清风牌,电源:开,风速:3 品牌:清风牌,电源:关,风速:0 注意:只修改每个“//ERROR****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{ return intensity;)//返回风速 boo1 isOn()const{return intensity>0;}//返回电源开关状态//ERROR**********found********** void turnOff(){intensity=1;)//关电扇 void setIntensity(int inten){//开电扇并设置风速//ERROR**********found********** if(intensity>=1&&intensity<=3) intensity=inten; } void show(){ cout<<"品牌:"<<theBrand()<<”牌” <<”,电源:”<<(isOn()?”开”:”关”) <<”,风速:”<<theIntensity()<<end1; } }; int main(){ ElectricFan fan(”清风”); fan.show(); fan.setIntensity(3); fan.show(); fan.turnOff(); fan.show(); return 0; }
进入题库练习
问答题请使用VC6或使用【答题】菜单打开考生文件夹projl下的工程projl,此工程中含有一个源程碍文件 projl.epp。其中位于每个注释“//ERROR ****found****”之后的一行语句存在错误。请改正这些错误,使程序的输出结果为: ConstruCtor Called. The value is 10 Copy ConstruCtor Called. The value is 10 DestruCtor Called. DestruCtor Called. 注意:只修改注释“//ERROR ****found****”的下一行语句,不要改动程序中的其他内容。 //pwjl.Cpp #inClude ’using namespaCe std; Class MyClass{ publiC: //ERROR**********found********** MyClass(int i) {value=i;Cout<<”ConstruCtor Called.” <
进入题库练习
问答题使用VC6打开考生文件夹下的源程序文件modi3.cpp,其中定义了用于表示日期的类Date,但类Date的定义并不完整。请按要求完成下列操作,将类Date的定义补充完成。(1)定义私有数据成员year、month和day,分别用于表示年、月和日,它们都是int型的数据。请在注释//********1********之后添加适当的语句。(2)完成默认构造函数Date的定义,使Date对象的默认值为:year=1,month=1,day=1,请在注释//********2********之后添加适当的语句。(3)完成重载构造函数Date(int y,int m,int d)的定义,把数据成员year、month和day分别初始化为参数y、m和d的值,请在注释//********3********之后添加适当的语句。(4)完成成员函数print()的类外定义,使其以“年—月—日”的格式将Date对象的值输出到屏幕上,例如:2008—8—8。请在注释//********4********之后添加适当的语句。注意:仅在函数指定位置添加语句,请勿改动主函数main与其他函数中的任何内容。#include<iostream.h>class Date{public://********2********Date(int y,int m,int d){//********3********}void print:()const;private://data member//********1********};void Date::print()const{//********4********}int main(){Date national_clay(1949,3.0,1);national_day.print();return0;}
进入题库练习
问答题请使用VC6或使用[答题]菜单打开 proj3下的工程proj3,其中声明的DataList类,是一个用于表示数据表的类。sort成员函数的功能是将当前数据表中的元素升序排列。请编写这个sort函数。程序的正确输出应为: 排序前:7, 1, 3, 11, 6, 9, 12, 10, 8, 4, 5, 2 排序后:1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 要求: 补充编制的内容写在“//********333********”与“//********666********”两行之同。不得修改程序的其他部分。 注意:程序最后将结果输出到文件out. dat中。输出函数writeToFile已经编译为obj文件,并且在本程序调用。 //DataList. h #include<iostream> using namespace std; class DataList {//数据表类 int len; double*d; public: DataList(int len, double data[]=NULL); ~DataList() {delete[]d;} int length()const {return len;}//数据表长度(即数据元素的个数) double getElement(int i)const {return d[i];} void sort();//数据表排序 void show()const;//显示数据表 }; void writeToFile(char*, const DataList //main. cpp #include "DataList. h" DataList::DataList(int len, double data[]): len(len) { d=new double[len]; for(int i=0; i<len; i++) d[i]=(data==NULL? 0.0: data[i]); } void DataList::sort(){//数据表排序 //********333******** //********666******** } void DataList::show()const {//显示数据表 for(int i=0; i<len-1; i++)cout<<d[i]<<","; cout<<d[len-1]<<endl; } int main() { double s[]={7, 1, 3, 11, 6, 9, 12, 10, 8, 4, 5, 2}; DataList list(12, s); cout<<"排序前:"; list. show(); list. sort(); cout<<endl<<"排序后:"; list.show(); writeToFile(" ", list); return 0; }
进入题库练习
问答题请使用VC6或使用【答题】菜单打开 proj2下的工程proj2,该工程中包含一个程序文件main.cpp,其中有类AutoMobile(“汽车”)及其派生类Car(“小轿车”)、Truck(“卡车”)的定义,还有主函数main的定义。请在横线处填写适当的代码并删除横线,以实现上述类定义。此程序的正确输出结果应为: 车牌号:冀ABC1234 品牌:ForLand 类别:卡车当前档位:0 最大载重量:12 车牌号:冀ABC1234 品牌:ForLand 类别:卡车当前档位:2 最大载重量:12 车牌号:沪XYZ5678 品牌:QQ 类别:小轿车 当前档位:0 座位数:5 车牌号:沪XYZ5678 品牌:QQ 类别:小轿车 当前档位:-1 座位数:5 注意:只能在横线处填写适当的代码,不要改动程序中的其他内容,也不要删除或移动“// ****found****”。 #include <iostream> #include <iomanip> #include <cmath> using namespace std; class AutoMobile{ //“汽车”类 char * brand; //汽车品牌 char * number; //车牌号 int speed; //档位1、2、3、4、5,空档:0,倒挡:-1 public: AutoMobile(const char * the_brand, const char * the_number): speed(0) { brand = new char[strlen (the_brand) +1]; // **********found********** ______; // **********found********** ______; strcpy (number, the number); } ~AutoMobile ____ {delete[] brand; delete[] number;} const char * theBrand ____ const {return brand;} //返回品牌名称 const char * theNumber ____ const {return number;} //返回车牌号 int currentSpeed ____ const {return speed;} //返回当前档位 void changeGearTo (int the_speed) { //换到指定档位 if (speed >= -1 } virtual const char * category ____ const =0; //类别:卡车、小轿车等 virtual void show ____ const { cout << "车牌号:" << theNumber ____ // **********found********** << "品牌:" << << "类别:" << category ____ << "当前档位:" << currentSpeed ____ ; } }; class Car: public AutoMobile{ int seats; //座位数 public: Car (const char * the_brand, const char * the_number, int the_seats): AutoMobile (the_brand, the_number), seats (the_seats) {} int numberOfSeat ____ const {return seats;} //返回座位数 const char * category ____ const {return "小轿车";} //返回汽车类别 void show ____ const { AutoMobile::show ____ ; cout << "座位数:" << numberOf Seat ____ << endl; } }; class Truck: public AutoMobile{ //“卡车”类 int max_load; //最大载重量 public: Truck (const char * the_brand, const char * the_number, int the_max_load): AutoMobile (the_brand, the_number), max_load(the_max_load) {} int maxLoad ____ const {return max_load;} //返回最大载重量 // **********found********** const char * category ____ ______ //返回汽车类别 void show ____ const { AutoMobile::show ____ ; cout << "最大载重量:" << maxLoad ____ << endl; } }; int main ____ { Truck truck ("ForLand","冀ABC1234", 12); truck.show ____ ; truck.changeGearTo(2); truck.show ____ ; Car car ("QQ", "沪XYZ5678",5); car.show ____ ; car.changeGearTo(-1); car.show ____ ; cout << endl; return 0; }
进入题库练习
问答题使用VC6打开考生文件夹下的源程序文件modil.cpp,该程序运行时有错误,请改正错误,使得程序正常运行。并使程序输出结果为: ABCDEF ABCDEF ABCDEF 注意:不要改动main函数,不能增行或删行,也不能更改程序的结构,错误的语句在∥********error********的下面。 #include void main() { ∥********error******** char s 1[]=”ABC “DEF”; ∥********error******** char s2[]=”ABC DEF”; ∥********error******** char S3[]=“ABC”+“DEF”; Cout<
进入题库练习
问答题使用VC6打开考生文件夹下的源程序文件modi2.cpp。请完成函数fun(char*s),该函数完成以下功能: (1)把s中的大写字母转换成小写字母,把其中的小写字母转换成大写字母。并且在函数中调用写函数WriteFile()将结果输出到modi2.txt文件中。 例如:s="helloTEST",则结果为:s="HELLOtest" (2)完成函数WriteFile(char*s),把字符串输入文件中。 提示:打开文件使用的第二参数为ios_base::binarylios_base::app。 注意:不要改动main()函数,不得增行或删行,也不得更改程序的结构。 #include #include #include using namespace std; void WriteFile(char*s) { } void fun(char*s) { } void ClearFile() { ofstream out1; out1.open("modi2.txt"); out1.Close(); } int main() { C1earFile(); char s[1024]; cout<<"please input a string: "<
进入题库练习
问答题请使用VC6或使用【答题】菜单打开考生文件夹prog1下的工程prog1。此工程中包含程序文件main.cpp,其中有类Score(“成绩”)和主函数main的定义。程序中位于每个“//ERROR****found****”之后的一行语句有错误,请加以改正。改正后程序的输出结果应为: 学号:12345678 课程:英语 总评成绩:85 注意:只修改每个“//ERROR****found****”下的一行,不要改动程序中的其他内容。#include<iostream>using namespace std;class Score{public: Score(const char*the course,const char*the id,int the normal,int the midterm,int the end of term) :course(the course),normal(the normal),midterm(the midterm),end of term(the end of term){ //ERROR**********found********** strcpy(the id,student_id); } const char*getCourse()const{return course;)//返回课程名称//ERROR**********found********** const char*getID()const{return //总评成绩中平时成绩占20%,期中考试占 30%,期末考试占50%,最后结果四舍五入为 一个整数 //ERROR**********found********** int getFinal()const{ return normal*0.2+midterm*0.3+end_of_term*0.5+0.5;}int main(){ char English[]=”英语”; Score score(English,”12345678”,68,83,92);cout<<”学号:”<<score.getID()<<"";cout<<”课程:”<<score.getCourse()<<””; cout<<”总评成绩:”<<score.getFi—nal()<<endl; return 0;}
进入题库练习
问答题函数check()用来判断字符串s是否是“回文”(顺读和倒读都一样的字符串称为“回文”,如abcba)。若是回文,函数返回值为1;否则返回值为0。请完成此函数的定义。 注意:部分源程序已存在考生文件夹的文件PROC7.cpp中。 请勿修改主函数和其他函数中的任何内容,仅在函数check()的花括号中填写若干语句。 文件PROC7.cpp的内容如下: //PROC7.cpp #include<iostream> #include<string> using namespace std; int check(char*s); int main() char str[100],*p; cout<<"Input your string!"; cin>>str; p=str; cout<<"The result is:"<<check(p)<<end1; int check(char*s) // * * * * + * * *
进入题库练习