I do not understand how to make a condition for checking each character on pseudographics (176-223 characters), delete them, display the corrected sentence and calculate the difference between the original sentence and the resulting one.

Here is my code:

program pr11; uses crt; procedure ms(var s,s1: string; var r:byte); var i:integer; begin while i < length(s) do begin i:=i+1; if ord(s[i]) in [176..223] then delete (s,i,1) end; end; var s, s1:string; r:byte; begin writeln('Введите предложение: '); readln(s); ms(s,s1,r); writeln(' разность= ',r); writeln('Изменённое предложение: ', s); end. 

    2 answers 2

     i := 1; while i <= Length(s) do begin if ord(s[i]) in [176..223] then Delete(s, i, 1) else i := i + 1; end; 

    difference between the original offer and the resulting

    what's this?

    • I don’t need the difference, I’ll finish it myself, so that after entering the sentence from the letters and symbols of the pseudographics, he would edit it and leave only the letters - Yevgeny Yeremeyev
    • for example, we introduce the sentence: hello ═╠╬═ - Evgeny Eremeev
    • @ YevgenyYeremeyev So wrote already. - Igor
    • but he does not remove pseudographics from the sentence ... - Evgeny Eremeev
    • I've already tried everything - Evgeny Eremeev

    I offer you this option - not to remove characters from the string, but to immediately place them in the two lines of the result - the cleared string ( r1 ) and with the difference in the form of the removed symbols ( r )

     program pr11; uses crt; procedure RemovePD(const s: string; s1, r: string); var i: integer; begin s1 := ''; r := ''; for i := 1 to Length(s) do if Ord(s[i]) in [176..223] then r := r + s[i] else s1 := s1 + s[i]; end; end; var s, s1, r: string; begin writeln('Введите предложение: '); readln(s); RemovePD(s,s1,r); writeln(' разность= ', r); writeln('Изменённое предложение: ', s1); end.