The string is flipped and the word does not flip inside. If I am from chongqing->chongqing from AM I
1#include <stdio.h>2#include <stdlib.h>3#include <string.h>4 5 voidReverseChar*STR,intBegintend);6 voidReversesentece (Char*str);7 intMain ()8 {9 Charstr[ -];Tengets_s (str, -); One reversesentece (str); A puts (str); -System"Pause"); - return 0; the } - - voidReverseChar*STR,intBegintend) - { + Chartemp; - if(str = =NULL) + return; A while(Beg <=end) at { -temp =Str[beg]; -Str[beg] =Str[end]; -Str[end] =temp; -beg++; -end--; in } - } to + voidReversesentece (Char*str) - { the intBeg =0; * intEnd =0; $ if(str = =NULL)Panax Notoginseng return; - //Flip the whole sentence theReverse (str,0, strlen (str)-1); + //Partial Rollover A while(Str[end]! =' /') the { + //find the end of the word - while(Str[end]! =' /'&& Str[end]! =' ') $++end; $ //Flip a word -Reverse (str,beg,end-1); - if(Str[end] = =' /') the Break; -++end;WuyiBeg =end; the } -}
String rollover, word inside not flipped