A.Do you see the elephant?
B.Is the elephant in the cage?
C.What animals do you like?
D.Shall we go to the zoo?
第1题
若有以下程序: #include<iostream> usingnamespacestd; voidsub(intx,inty,int*2) { *z=y+x; } int main() { int a,b,C; sub(8,4,&A) ; sub(6,a,&B) ; sub(a,b,&C) ; cout<<a<<","<<b<<","<<c<<end1; return 0; }
A.12,18,30
B.-12,6,8
C.6,8,10
D.12,-18,16
第2题
有以下程序: #include <iostream> #include <fstream> using namespace std; int main () { ofstream ofile; char ch; ofile.open ("abc.txt"); cin>>ch; while (ch!='#' ) { cin>>ch; ofile.put(ch);
A.程序编译时出错
B.abc#
C.abc
D.#
第3题
有以下程序:
include <iostream>
include <string>
using nameSpace std;
class person
{
int age;
Char * name;
public:
person (int i, Char * str )
{
int j;
j = strlen(str ) + 1;
name = new char[ j ];
strcpy(name, str );
age = i;
}
~person()
{
delete name;
cout<<"D";
}
void display()
{
cout<<name<<":"<<age;
}
};
int main()
{
person demo(30,"Smith" );
demo.display();
return 0;
}
则该程序的输出结果为:【 】。
第4题
有以下程序#include <iostream>using namespace std;int a;int fun ();int main (){ extern int a; int b; a = 100; b = fun(); cout<<b<<end1; return 0;}int fun{){ extern int a; return (10*a ;} 其程序运行后的输出结果是
A.100
B.10
C.1000
D.10000
第5题
有以下程序: #include <iostream> #include <cstdlib> using namespace std; int main() { int arraysize; int *array; cout<<"Please input the size of the array:"; cin>>arraySiZe; array=new int[arraysize]; if(array==NULL) { cout<<"allocate Error\n"; exit(1); } for(int i=0;i<arraysize;i++) array[i]=i*i; int j; cout<<"which element you want to check:"; cin>>j; cout<<array[j]<<end1; return 0; } 执行程序输入:10<空格>5,则输出结果为()。
A.allocate Error
B.1
C.0
D.25
第6题
下面程序的输出结果是()。
#include<iostream>
Usingnamespacestd;
ClassBase{
public:
Base(intx=O){cout<<x;
}
};
ClassDerived:publicBase{
public:Derved(intx=0{cout<<x;
}
private;
Baseval;
};
int main(){
Derivedd(1);
retrun0;
}
A.0
B.1
C.01
D.001
第7题
有以下程序: #include<iostream> using namespace std; int a; int fun(); int main() { externint a; int b; a=10; b=fun(); cout<<b<<end1; return 0; } int fun() { extern int a; return(10*a); } 其程序运行后的输出结果是()。
A.10
B.1
C.100
D.1000
第8题
有以下程序: #include <iostream> using namespace std; int main() { int x; for(int i=1;i<=100;i++) { x=i; if (x%2==0) if (x%3==0) if (x%7==0) cout<
A.39,81
B.42,84
C.26,68
D.28,70
第9题
有以下程序:
include <iostream>
using namespace std;
int main()
{
int i=010,j=10;
cout<<(i)<<","<<i--<<end1;
return 0;
}
则该程序运行后的输出结果是【 】。
第10题
有以下程序:
include <iostream>
using namespace std;
class CFactorial
{
private:
int value;
int fact;
public:
CFactorial (int val );
void CalculateFactorial();
void Display();
};
CFactorial :: CFactorial(int val )
{
value = val;
fact = 1;
}
void CFactorial :: CalculateFactorial()
{
int i = value;
while (i > 1 )
fact *= i--;
}
void CFactorial :: Display()
{
cout<<value<<"!="<<fact<<end1;
}
int main()
{
CFactorial A(5 );
A.CalculateFactorial();
A.Display();
return 0;
}
程序中,类CPactorial的功能是【 】,该程序运行的结果是【 】。
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!