Given the text. Print all the words that are different from the last one, after converting each of them according to the following rule: - swap the first and last letters of the word; Make via Pchar.

I did not find examples on PChar in nete. How it will look like, I only know that the procedures and functions are a bit different.

Through the lines:

Uses CRT; Var StrMas: Array[0..199] Of String; Str, MStr: String; MasInd, StrInd, StrLen, i: Word; C: Char; Begin Write('Введи строку: '); ReadLn(Str); StrLen:=Length(Str); StrInd:=1; MasInd:=0; While (StrInd<=StrLen) Do Begin While ((Str[StrInd]=' ') And (StrInd<=StrLen)) Do Inc(StrInd); MStr:=''; While ((Str[StrInd]<>' ') And (StrInd<=StrLen)) Do Begin MStr:=MStr+Str[StrInd]; Inc(StrInd); End; If (MStr<>'') Then Begin C:=MStr[1]; MStr[1]:=MStr[Length(MStr)]; MStr[Length(MStr)]:=C; StrMas[MasInd]:=MStr; End Else Break; Inc(MasInd); Inc(StrInd); End; For i:=0 To MasInd-2 Do If (StrMas[i]<>StrMas[MasInd-1]) Then WriteLn(StrMas[i]); WriteLn('Нажми на любую кнопку!!!'); Repeat Until (KeyPressed); End. 

    1 answer 1

    Here is what I managed to write:

     Program words; Uses CRT, Strings; Var (* этот массив у меня заполняется, но все его элементы становятся равными (не стал разбираться) StrMas: Array[0..199] Of Char; *) StrMas: Array[0..199] Of String; // с этим всё прокатывает Str, WordStr: Array[0..1999] Of Char; PStr, MStr: PChar; MasInd, StrInd, Len, i, j, WordInd: Word; C, K: Char; Begin ClrScr; Write('Введи строку: '); StrInd:=0; Repeat Read(C); Str[StrInd]:=C; Inc(StrInd); Until (C=#13); Str[StrInd-1]:=#0; PStr:=Str; Len:=StrLen(PStr); StrInd:=0; MasInd:=0; While (StrInd<Len) Do Begin While ((PStr[StrInd]=' ') And (StrInd<Len)) Do Inc(StrInd); If (StrInd=Len) Then Break; WordInd:=0; While ((PStr[StrInd]<>' ') And (StrInd<Len)) Do Begin WordStr[WordInd]:=Char(PStr[StrInd]); Inc(WordInd); Inc(StrInd); End; MStr:=WordStr; MStr[WordInd]:=#0; If (MStr<>Nil) Then Begin C:=MStr[0]; K:=MStr[WordInd-1]; MStr[0]:=K; MStr[WordInd-1]:=C; StrMas[MasInd]:=String(MStr); Inc(MasInd); End Else Break; Inc(StrInd); End; For i:=0 To MasInd-2 Do If (StrMas[i]<>StrMas[MasInd-1]) Then WriteLn(StrMas[i]); WriteLn('Нажми на кнопку ANY KEY!!!'); Repeat Until (KeyPressed); End. 
    • 255 characters are entered anyway, because you type in a string. How to write in PChar I do not know, this type is only a pointer to char - lybntras