填空题以下程序的执行结果是 【14】 。 #include<iostream> using namespace std; class base public: virmal void who()cout<<"Base Class"<<endl;) ; class Derivedl:public Base public: virtual void who()cout<<"Derivedl Class"<<endl; ; class derived2:public Base public: virtual void who()cout<<"Derived2 Class"<<endl;) ; int main(int argc,char*argv[]) base obj1,*P; deliVedl obj2; derived2 obj3; p=&obj1; p->who(); p=&obj2; p->who(); p=&obj3; p->who(); return 0;
填空题下列函数的功能是判断字符串str是否对称,对称则返回true,否则返回false。请在画线处填上适当内容,实现该函数。 bool fun(char*str) int i:0,j=0; while(str[j]) (6) ; for(J--;i<jstr[i]==str[J];i++,J--); return i (7) J;
填空题一个项目具有一个项目主管,一个项目主管可管理多个项目,则实体“项目主管”与实体“项目”的联系属于 的联系。
填空题写出下列程序的运行结果 [11] 。 #include<iostream. h> void func(double x, int void main( ) int n; double x, f; x=1001. 0103; func (x, n, f): cout<<"Part 1="<<n<<" , part2="<<f<<end1
填空题有以下程序: #include <iostream> using namespace std; const xnt N=5; int fun(char *s,char a,int n) int j; *s=a;j=n; while(a<s[j]) j--; return j; int main() char s[N+1]; int k; for(k=0;k<=N;k++) s[k]='A'+k+1; cout<<fun(s,'E',N)<<end1; return 0; 运行后的打印结果是 【8】 。
填空题语句int *;i=newint[10],释放指针i的语句是______。
填空题有下列程序: #include<iostream> using namespace std; class Con char ID; public: Con():ID('A')cout<<1; Con(char ID) :D(ID) cout<<2; Con(Con char getID()constreturn ID; ; void show(COn c)cout<<c.getID(); int main() Con c1; show(c1); Con c2('B'); show(c2); retum 0; 执行上面程序的输出结果是______。
填空题有如下程序,请将横线处缺失部分补充完整。
#include
using namespace std;
template
class Dataset{
T *data;
int size;
public:
Dataset(T* arr,int length):size(1ength){
data=new T[length];
for(int i=0;i
填空题阅读下面的程序:
#include<iomanip.h>
void main()
{
cout.fill('!');
cout<<setiosflags(ioS::left)<
填空题以下程序的执行结果是______。 #include<iostream.h> #include<stdliB.h> class Sample public: int x, y; Sample()x=y=0; Sample(int a, int b)x=a;y=b; void disp() cout<<"x="<<x<<", y="<<y<<end1; ; void main() Sample s1(2,3); s1.disp();
填空题如果类中的一个成员函数的定义实现在类内,则该函数系统自动默认为该类的{{U}} 【10】 {{/U}}函数。
填空题顺序存储方法是把逻辑上相邻的结点存储在物理位置{{U}} 【2】 {{/U}}的存储单元中。
填空题若有以下程序: #include <iostream> using namespace std; template <class T> T min(T x,T y) if(x<y) return x; else return y; int main() int n1=2,n2=10; double d1=1.5;d2=5.6; cout<<min(n1,n2)<<","; cout<<min(d2,d2)<<end1; return 0; 程序运行后的输出结果是 【13】 。
填空题下列程序的输出结果为: Objectid=O Obiectid=1 请将程序补充完整。 #include<iostream> using namespace std; class Point public: Point(int xx=0,int yy=0)X=xx;Y=yy;countP++; ~Point()countP--; int GetX()return X; int GetY()return Y; static void GetC()cout<<"Object id="<<countP<<endl; private: int X,Y; static int countP; ; ______//静态数据成员的初始化 int main() Point::GetC(); Point A(4,5); A.GetC(); return 0;
填空题设有定义语句:double x=2.5,y=4.7;int a=7;,那么表达式x+a%3*(int)(x+y)%2/4的值为{{U}} 【6】 {{/U}}。
填空题在深度为4的满二叉树中,叶子结点的个数为 【1】 。
填空题使用VC6打开
下的源程序文件modi2.cpp。阅读下列函数说明和代码,完成空出部分程序。函数convert(char* strOct)的功能是将八进制转换为十进制。
提示:要每一位转换,然后把转换后得到的数累加起来即可。
注意:不能修改其他部分的代码。
#include<iostream.h>
#include<cmath>
int convert(char* strOct)
{
}
int main()
{
cout
convert("7")
endl;
cout
convert("10")
endl;
cout
convert("1234")
endl;
return 0;
}
填空题有以下程序:
#include <iostream>
using namespace std;
void t(int x,int y, int cp,int dp)
{
cp=x*x+y+y;
dp=x*x-y*y;
}
int main()
{
int a=4,b=3,c=5,d=6;
t(a,b,c,D) ;
cout<<c<<","<<d<<end1;
return 0;
}
运行后的输出结果为{{U}} 【9】 {{/U}}。
填空题建立数据字典的时机是 [5] 。
填空题下列程序的输出结果是{{U}} 【9】 {{/U}}。
#include<iostream>
using namespace std;
int main(){
int i=3;
int r=5;
cout<<i<<endl;
return 0;
}
