单选题
有如下程序: #include
using namespace std; int main() { char str[100],*P; cout<<”Please input a string:”; cin>>str; P=str; for(int i=0;*p!=’\0’;p++,i++); cout<
A、
7
B、
12
C、
13
D、
100
【正确答案】
B
【答案解析】
考查对字符串标准输入结束标志符的理解,即在字符的尾部包含一个空字符’\o’,由于字符串str长度为12,所以i=12。
提交答案
关闭