单项选择题
有如下程序:
#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
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
问答题
下面程序对一维坐标点类Point进行了运算符重载: #include <iostream> using namespace std; class Point public: Point(int val)x=val; Point& operator++( )x++;return*this; Point operator++(int)Point old=*this;++(*this);return old; int GetX( )eonst t return x; private: int x; ; int main( ) Point a(10); cout<<(++
点击查看答案&解析
单项选择题
有如下程序: #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
点击查看答案&解析
相关试题
Date
空格
0
下列程序的输出结果为: Ohject id=0 ...
friend:Date