如下程序执行后的输出结果是【 】。
include <iostream>
using namespace std;
class Base
{
public:
Base(int x,int y)
{
a=x;
b=y;
}
void Show()
{
cout<<"Base: "<<a<< ',' <<b<<" ";
}
private:
int a,b;
};
class Derived : public Base
{
public:
Derived(int x, int y, int z) : Base(x,y),c(z) { }
void Show()
{
cout<<"Derived:"<<c<<end1;
}
private:
int c;
};
int main()
{
Base b(100,100),*pb;
Derived d(10,20,30);
pb=&b;
pb->Show();
pb=&d;
pb->Show();
return 0;
}
第1题
执行如下程序后的输出结果是【 】。
include <iostream>
include <fstream>
using namespace std;
int main ()
{
char s[25];
ofstream fl("data.txt");
f1<<"C++ Programming";
f1.close ();
ifstream f2 ("data.txt");
第3题
阅读如下程序段,则执行后程序的输出结果是
#include
main()
{structa{int x; int y;}num[2]={{20,5},{6,7}};
printf("%d\n",num[0].x/num[0].y*num[1].y);}
A.0
B.28
C.20
D.5
第4题
有以下程序:
# include< iostream>
执行这个程序,输出结果是()。
第5题
有如下程序: #include<iostream> using namespace std; int main() { cout.fill('*') cout.width(6); cout.fill('#') cout<<123<<endl; return 0; } 执行后的输出结果是
A.###123
B.123###
C.***123
D.123***
第7题
有如下程序: #include <iostream> using namespace std; int main(){ cout.fill('*'); cout.width(6); cout.fill('#'); cout<<123<<end1; return 0;} 执行后的输出结果是
A.###123
B.123###
C.***123
D.123***
第8题
有如下程序:#include <iostream>#include<iomanip>using namespace std;int main(){ cout.fill('*'); cout.width(6); cout.fill('#'); cout<<123<<end1; return 0;}执行后的输出结果是()。
A.###123
B.123###
C.***123
D.123***
第9题
有如下程序:
#include<iostream>
usingnamespacestd;
classBASE{
public:
~BASE(){cout<<"BASE";}
};
classDERIVED:publicBASE{
public:
~DERIVED(){cout<<"DERIVED";}
};
intmain(){DERIVEDx;return0;)
执行后的输出结果是()。
A.BASE
B.DERlVED
C.BASEDERIVED
D.DERlVEDBASE
第10题
有以下程序,程序执行后,输出结果是【11】
#include <stdio.h>
void fun (int *a)
{a[0=a[1];]}
main()
{int a[10]={10,9,8,7,6,5,4,3,2,1},i;
for(i=2;i>=0;i--) fun{&a};
for(i=0;i<10;i++) printf(“&d”,a);
printf(“\n”);
}
第11题
有以下程序 #include <stdio.h> main() { int k=5; while(--k) printf("%d",k -= 3); printf("\n"); } 执行后的输出结果是()
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!