此程序未出现任何结果:
#include<iostream.h>
void main()
{
char *s=new char[]="this is a short string.";
int count=0;
while(*s!='\0')
{
if(*s=='s') count++;
else
s++;
}
cout << count << endl;
}
原因: