A-A+
从键盘上输入XXYYZZXYZWXP和X 以下程序的输出结果是【 】。 include<io
问题详情
从键盘上输入XXYYZZXYZWXP和X,以下程序的输出结果是【 】。
include<iostream.h>
include<string.h>
void main(){
char*str,ch;
int count=0,pos;
cin>>str>>ch;
pos=strlen(str)-1;
while(pos>=0){
if((str[pos])=ch)count++;
pos--;
}
cout<<"count="<<count;
}请帮忙给出正确答案和分析,谢谢!
参考答案
正确答案:count=4
count=4