单项选择题
有如下程序:
#include <iostream>
using namespace std;
int main( )
char str[100],*P;
cout<<"please input a string:";
cin>>str;
P=str;
for(inti=0;*P!=’\0’;p++,i++);
cout<<i<<endl;
return 0;
运行这个程序时,若输入字符串为
Abcdefg abcd
则输出结果是
A.7
B.12
C.13
D.100
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
有如下程序: #include<iostream> using namespace std; class A public: static int a; void init( )a=l; A(int a=2)init( );a++; ; int A::a=0; A obj; int main( ) cout<<obj.a; return 0; 程序的输出结果是
A.0
B.1
C.2
D.3
点击查看答案&解析
单项选择题
有如下程序: #include <iostream> using namespaee std; class Point public: static int number; Point( )number++; ~Point( )number--; ; int Point::number=0; void main( ) Point*ptr; Point A,B; Point*ptr_point=new Point[3]; ptr=ptr_point; Point C; cout<<Point::number<<endl; delete[ ]ptr; 程序的输出结果是
A.3
B.4
C.6
D.7
点击查看答案&解析
相关试题
如果不使用多态机制,那么通过基类的指针虽...