单项选择题

以下程序的输出结果是
#include <iostream.h>
void main ()
int a=0, i;
for (i=1; i<5; i++)
switch (i)

case 0 :
case 3 : a+=2;
case 1 :
case 2 : a+=3;
default : a+=5;

cout<<a<<endl;
return;

A.31
B.13
C.10
D.20
<上一题 目录 下一题>
热门 试题

单项选择题
有如下的程序: #include <cstring.h> #include <iostream.h> using namespace std; class MyString public: MyString(const char*s); ~MyString () delete [] data; protected: unsigned len; char*data; ; MyString::MyString(const char *s) len=strlen (s); data=new char[len+1]; strcpy (data,s); int main () MyString a( C++ Programing ); MyString b(
A.;
return 0;

在运行上面的程
单项选择题
有如下程序: #include <iostream> void fun(int& x, int y)int t=x;x=y;y=t; int main () int a[2]=23,42; fun(a[1],a[0]); std::cout<<a[0]<< , <<a[1]<<std::endl; return 0; 执行后的输出结果是
A.42,42
B.23,23
C.23,42
D.42,23
相关试题
  • 下面是一个栈类的模板,其中push函数将元素...
  • 下列程序将x、y和z按从小到大的顺序排列,...
  • 多数运算符既能作为类的成员函数重载,也能...
  • 假定A为一个类,则语句A(A &a);为该类...
  • 在下面程序的横线处填上适当的语句,使该程...