未分类题
从键盘上输入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;
}
A.h>
B.h>
【参考答案】
count=4
count=4