单项选择题

以下程序执行后的输出结果是
#include<iostream>
using namcspace std;
void try(int,int,int,int);
int main()
int x,y,z,r;
x=1;
y=2;
try(x,y,z,r);
cout<<r<<end1;
return 0;
void try(int x,int y, int z,int r)
z = x+y;
x = x*x;
y = y*y;
r = z+x+y;

A.18
B.9
C.10
D.不确定
<上一题 目录 下一题>
热门 试题

单项选择题
有以下程序: #include<iostream> using namespace std; class sample private: int n; public: sample() sample(int m) n=m; sample add(sample s1,sample s2) this->n=s1.n+s2.n; return(*this); void disp() cout<< n <<n<<end1; ; int main() sample s1(10),s2(5),s3; s3.add(s1,s2); s3.disp(); return 0; 程序运行后,输出的结果是
A.n=10
B.n=5
C.n=20
D.n=15
单项选择题
如果表达式y*x++中,“*”是作为成员函数重载的运算符,“++”是作为友元函数重载的运算符,采用运算符函数调用格式,该表达式还可表示为
A.operator++(0).operator*(y);
B.operator*(x.operator++(0),y);
C.operator*(operator++(x,O))
D.operator*(operator++(x,0),y)
相关试题
  • 下列程序将x、y和z按从小到大的顺序排列,...
  • 下面程序的输出是: **********...
  • 假定A为一个类,则语句A(A &A) ;为该...
  • 在下面的程序的横线处填上适当的语句,是该...
  • 下列程序的输出结果是 【10】 。 #in...