字符串中单词的逆转,即将单词出现的顺序进行逆转。如将“Today is Friday!”逆转为“Friday! is Today”. 48 49 #include<iostream> 50 #include<stdio.h> 51 void Reverse(char *pb,char *pe) 52 { 53 if(pb==NULL||pe==NULL) 54 return; 55 while(pb<pe) 56 { 57 char tmp=*pb; 58 *pb=*pe; 59 *pe=tmp; 60 pb++,pe--; 61 } 62 } 63 64 char *ReverseSentence(char *pData) 65 { 66 if(pData==NULL) 67 return NULL; 68 char *pBegin=pData; 69 char *pEnd=pData; 70 while(*pEnd!='