单项选择题

有如下程序: #include <iostream> using namespace std; int getSum(int num); int main () { int i; for (i=1; i<4; i++) cout<<getSum(i); return 0; } int getSum(int hum) { static int sum=O; sum+=num; return sum; } 上述程序执行后的输出结果是( )。

A.136
B.248
C.123
D.135
<上一题 目录 下一题>
热门 试题

单项选择题
若有以下程序 #include <iostream> using namespace std; class A { public: A(int i,int j) { a=i; b=j; } void move(int x, int y) { a+=x; b+=y; } void show() { cout < <a < < , <<b<< end1; } private: int a,b; }; class B : private A { public: B(int i,int j) :A(i,j) {} void fun ( ) { move (3, 5); } void f1 ( ) { A::show(); } }; int main ( ) { B d(3,4); d. fun ( ); d.f1(); return 0; } 程序执行后的输出结果是 ( )。
A.3,4
B.6,8
C.6,9
D.4,3
单项选择题
有以下程序: #include <iostream> using namespace std; int f1(int x, int y) { return x>y x:y; } int f2(int x, int y) { return x>y y:x; } int main ( ) { int a = 4,b = 3,c = 5,d,e,f; d = f1(a,b) ; d = f1(d,c) ; e = f2 (a,b) ; e = f2(e,c) ; f = a+b+c-d-e; cout<<d<< , <<e<< , <<f<<end1; return 0; } 执行后的输出结果是 ( )。
A.3,4,5
B.5,3,4
C.5,4,3
D.3,5,4
相关试题
  • 以下程序运行后的输出结果是 【14】 。...
  • 若有以下程序:#include <iostream>usi...
  • 有如下的程序:#include <iostream>#i...
  • 在C++语言中,每个类都有一个隐含的指针...
  • 经常和一个运算符连用,构成一个运算符函数...