字符串输出问题。
#include<iostream.h>
#include<string.h>
void piglatin(char *a)
{
char *b=strtok(a," ");
char c=*b;
char *d=b; //在下一行加入cout<<b;可以输出b.
for(;*b!='\0';b++)
{
if(*(b+1)!='\0')
*b=*(b+1);
else
*b=c;
cout<<b<<'\n';
}
cout<<d; //如果把d换为b.输出不了b.为什么?
}
int main()
{
char a[100]="jump the computer";
piglatin(a);
return 0;
}