Home computickets Error: no default index property for char

Error: no default index property for char

Author

Date

Category

I can’t understand what the problem is (the line is specified)

var
  i: char;
  j: integer;
  s: string;
  x: boolean;
begin
  writeln('Enter the string:');
  readln(s);
  for i := char[33] to char[255] do{He writes here:no default index property for typechar}
  begin
    x := false;
    for j := 1 to length(s) do
    begin
      if i = s[j] then
      begin
        if not x then 
          write(i, ' - ');
          write(s[j], ' ');
          flag:=true
      end;
      if x then writeln;
    end;
  end;
end.

Answer 1

for i := char(33) to char(255) do

or

for i := chr(33) to chr(255) do

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions