单项选择题

在下面程序运行 #include<iostream.h> int func(char s[]){ int length=0; while(*(s+length))length++; return length; } void main(){ char a[10], *ptr=a; cin>>ptr; cout<<fune(ptr)<<end1; } 如果输入字符串Hello!并回车,则输出结果为 ______。

A.4
B.7
C.6
D.5
<上一题 目录 下一题>
热门 试题

单项选择题
下面程序的结果是 ______。 #include<iostream.h> class A{ public: virtual void fun()=0{}; }; class B:public A{ public: void fun () {cout<< new file ;} }; class C: public A{ public: void fun (){cout<< open file << } }; class D: public A{ public: void fun () {cout<< save file n ;} }; void main() { A a,*p; B b; C c; D d; p=&c; p->fun (); p=&b; p->fun (); p=&d; p->fun(); }
A.new file open file save file
B.new file new file new file
C.编译出错
D.open file new file save file
单项选择题
以下程序的执行后,x和y的值是 ______ 。 #include <iostream. h> class Sample { public: int x; int y; void disp() { cout<< x= <<x<< , y= <<y<<end1; } }; void main() int Sample: :*pc; Sample s; pc=&Sample:: x; s. *pc=10; pc=&Sample: :y; s. *pc=.20; s. disp ();
A.x=10, y=20
B.x=20, y=10
C.x=10, y=10
D.x=20, y=20
相关试题
  • 函数中的形参和调用时的实参都是变量时,参...
  • 采用顺序查找方法查找长度为n的线性表,平...
  • 下列程序中声明了两个类AA和BB,其中函数“...
  • 多态性可分为二类:编译时和 [15] 。
  • 以下程序的输出结果是 [10] 。char ...