单项选择题

以下程序的输出结果是( )。 #include<iostream.h> void main() { int a(5),b(6),i(0),j(0); switch(a) { case 5:switch(b) { case 5:i++;break; case 6:j++;break; default:i++;j++; } case 6:i++; j++; break; default:i++;j++; } cout<<i<<","<<j<<endl; }

A.1,2
B.1,3
C.2,2
D.2,3
<上一题 目录 下一题>
热门 试题

单项选择题
有以下程序: #include<iostream> using namespace std; class R { public: R(int r1,int r2) { R1=r1; R2=r2; } void print(); void print0const; private: int R1,R2; }; void R::print() { cout<<R1<< , <<R2<<endl; } void R::print() const { cout<<Rl<< , <<R2<<endl; } int main() { R a(5,4); const R b(20,52); b.print(); return 0; } 执行后的输出结果是( )。
A.5,4
B.20,52
C.0,0
D.4,5
单项选择题
若有如下程序: #include<iostream> using namespace std; int s=0; class sample { static int n; pubic: sample(int i) { n=i; } static void add() { S+=n; } }; int sample::n=O; int main() { sample a(2),b(5); sample::add(); cout<<s<<endl; return 0; } 程序运行后的输出结果是( )。
A.2
B.5
C.7
D.3
相关试题
  • 以下程序的执行结果是 【13】 。#incl...
  • 下面程序的功能是:将字符数组a中下标值为...
  • 当循环队列非空且队尾指针等于队头指针时,...
  • 将x+y*z中的“+”用成员函数重载,“*...
  • 下列程序的输出结果是 【10】 。#incl...