问题
填空题
从键盘上输入XXYYZZXYZWXP和X,以下程序的输出结果是 [9] 。 #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