Форум программистов, компьютерный форум, киберфорум
Lazarus
Войти
Регистрация
Восстановить пароль
Карта форума Темы раздела Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.81/21: Рейтинг темы: голосов - 21, средняя оценка - 4.81
0 / 0 / 0
Регистрация: 24.02.2019
Сообщений: 1
1

Ошибка: Illegal qualifier

24.02.2019, 14:10. Показов 4292. Ответов 1
Метки нет (Все метки)

Author24 — интернет-сервис помощи студентам
ругается на переменную k в open
в чем причина?(
если что, это сапер, open - процедура открытия пустых ячеек

Delphi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
unit Unit3;
 
{$mode objfpc}{$H+}
 
interface
 
uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Grids,
  StdCtrls, ExtCtrls, CheckLst, Types;
 
type
  ms = array of integer;
  { TForm3 }
 
  TForm3 = class(TForm)
    Label1: TLabel;
    StringGrid1: TStringGrid;
    procedure FormCreate(Sender: TObject);
    procedure Label1Click(Sender: TObject);
    procedure StringGrid1DrawCell(Sender: TObject;
  ACol, ARow: Integer; Rect: TRect;
  State: TGridDrawState);
    procedure StringGrid1MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
        a : array [1..9, 1..9] of integer;
        procedure open(i, k : integer; b : ms);
  public
  end;
 
var
  Form3: TForm3;
  StringGrid1: TStringGrid;
 
implementation
 
{$R *.lfm}
 
{ TForm3 }
 
procedure open(i, k : integer; b : ms);
begin
    StringGrid1.Cells[k - 1, i - 1] := ' ';
    if (k <> 1) and (b[i, k - 1] = 0) and (StringGrid1.Cells[k - 2, i - 1] <> ' ') then open(i, k - 1, b);
    if (k <> 9) and (b[i, k + 1] = 0) and (StringGrid1.Cells[k, i - 1] <> ' ') then open(i, k + 1, b);
    if (i <> 1) and (b[i - 1, k] = 0) and (StringGrid1.Cells[k - 1, i - 2] <> ' ') then open(i - 1, k, b);
    if (i <> 9) and (b[i + 1, k] = 0) and (StringGrid1.Cells[k - 1, i] <> ' ') then open(i + 1, k, b);
    if (i <> 1) and (k <> 1) and (b[i - 1, k - 1] = 0) and (StringGrid1.Cells[k - 2, i - 2] <> ' ') then open(i - 1, k -1, b);
    if (i <> 1) and (k <> 9) and (b[i - 1, k + 1] = 0) and (StringGrid1.Cells[k, i - 1] <> ' ') then open(i - 1, k + 1, b);
    if (i <> 9) and (k <> 1) and (b[i + 1, k - 1] = 0) and (StringGrid1.Cells[k - 2, i] <> ' ') then open(i + 1, k - 1, b);
    if (i <> 9) and (k <> 9) and (b[i + 1, k + 1] = 0) and (StringGrid1.Cells[k, i] <> ' ') then open(i + 1, k + 1, b);
end;
 
procedure mass(a:array  of integer);
var
  i, k : integer;
  l, b : integer;
begin
   randomize;
   b := 0;
   for i := 1 to 9 do
       for k := 1 to 9 do
           a[i, k] := 0;
   while b <= 10 do
   for i := 1 to 9 do
       for k := 1 to 9 do
           begin
              l := random(10);
              if l = 5 then
                 begin
                     b := b + 1;
                     a[i, k] := -1;
                 end;
           end;
   for i := 1 to 9 do
       for k := 1 to 9 do
           if a[i, k] = -1 then
              begin
                  if (k <> 1) and (a[i, k - 1] <> -1) then a[i, k - 1] :=  a[i, k - 1] + 1;
                  if (k <> 9) and (a[i, k + 1] <> -1) then a[i, k + 1] :=  a[i, k + 1] + 1;
                  if (i <> 1) and (a[i - 1, k] <> -1) then a[i - 1, k] :=  a[i - 1, k] + 1;
                  if (i <> 9) and (a[i + 1, k] <> -1) then a[i + 1, k] :=  a[i + 1, k] + 1;
                  if (i <> 1) and (k <> 1) and (a[i - 1, k - 1] <> -1) then a[i - 1, k - 1] := a[i - 1, k - 1] + 1;
                  if (i <> 1) and (k <> 9) and (a[i - 1, k + 1] <> -1) then a[i - 1, k + 1] := a[i - 1, k + 1] + 1;
                  if (i <> 9) and (k <> 1) and (a[i + 1, k - 1] <> -1) then a[i + 1, k - 1] := a[i + 1, k - 1] + 1;
                  if (i <> 9) and (k <> 9) and (a[i + 1, k + 1] <> -1) then a[i + 1, k + 1] := a[i + 1, k + 1] + 1;
              end;
end;
 
procedure TForm3.FormCreate(Sender: TObject);
var
  i, k : integer;
  l, b : integer;
begin
   randomize;
   b := 0;
   for i := 1 to 9 do
       for k := 1 to 9 do
           a[i, k] := 0;
   while b <= 10 do
   for i := 1 to 9 do
       for k := 1 to 9 do
           begin
              l := random(10);
              if l = 5 then
                 begin
                     b := b + 1;
                     a[i, k] := -1;
                 end;
           end;
   for i := 1 to 9 do
       for k := 1 to 9 do
           if a[i, k] = -1 then
              begin
                  if (k <> 1) and (a[i, k - 1] <> -1) then a[i, k - 1] :=  a[i, k - 1] + 1;
                  if (k <> 9) and (a[i, k + 1] <> -1) then a[i, k + 1] :=  a[i, k + 1] + 1;
                  if (i <> 1) and (a[i - 1, k] <> -1) then a[i - 1, k] :=  a[i - 1, k] + 1;
                  if (i <> 9) and (a[i + 1, k] <> -1) then a[i + 1, k] :=  a[i + 1, k] + 1;
                  if (i <> 1) and (k <> 1) and (a[i - 1, k - 1] <> -1) then a[i - 1, k - 1] := a[i - 1, k - 1] + 1;
                  if (i <> 1) and (k <> 9) and (a[i - 1, k + 1] <> -1) then a[i - 1, k + 1] := a[i - 1, k + 1] + 1;
                  if (i <> 9) and (k <> 1) and (a[i + 1, k - 1] <> -1) then a[i + 1, k - 1] := a[i + 1, k - 1] + 1;
                  if (i <> 9) and (k <> 9) and (a[i + 1, k + 1] <> -1) then a[i + 1, k + 1] := a[i + 1, k + 1] + 1;
              end;
end;
 
 
procedure TForm3.StringGrid1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
  var x1, y1, b, l : integer;
begin
   b := 10;
   l := 0;
  StringGrid1.MouseToCell(X,Y,X1,Y1);
  while  a[y1 + 1, x1 + 1] <> 0 do
      mass(a);
  Label1.Caption := 'Нажата ячейка ' + inttostr(x1 + 1) + ' ' + inttostr(y1 + 1);
  if  a[y1 + 1, x1 + 1] = 0 then open(x1, y1, a)
  else StringGrid1.Cells[x1, y1] := inttostr(a[y1 + 1, x1 + 1]);
 
end;                                                       
end.
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
24.02.2019, 14:10
Ответы с готовыми решениями:

Error: Illegal qualifier при кастомном типе
Приветствую местный контингент, всем доброго времени суток. К делу... unit QuestionResultUnit; ...

Найти сумму a2+a4+a6. Ошибка "illegal qualifier"
Даны целые числа a1, a2, ..., a20. Найти сумму a2+a4+a6 ... . Оператор цикла с шагом, отличным от 1...

Error: Illegal qualifier
написал такой код: type metk=(a,b); st=record mark:string; fio:string; ...

Error: Illegal qualifier
Добрый день, помогите решить проблему, студент, до этого не встречался с Паскаль. Пользуюсь...

1
Модератор
9267 / 6045 / 2380
Регистрация: 21.01.2014
Сообщений: 25,825
Записей в блоге: 3
24.02.2019, 14:23 2
Правильно ругается... Переменная b у Вас объявлена как одномерный динамический массив, а Вы туда пихаете 2 индекса, как для двумерного.
1
24.02.2019, 14:23
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
24.02.2019, 14:23
Помогаю со студенческими работами здесь

Ошибка identifier `pec` cannot have a type qualifier
Всем доброй ночи. Не пойму в чем ошибка, выдает такую ошибку &quot; identifier `pec` cannot have a...

Ошибка type qualifier 'std' must be a struct or class name
а у меня на эту строку typedef std::string T_str; выдается ошибка type qualifier 'std' must be a...

Ошибка [C++ Error] Unit1.h(30): E2089 Identifier 'isRight' cannot have a type qualifier
Что она означает?

Ошибка: При декодировании JSON возникла ошибка: Illegal Token
Добрый день. Сегодня решил обновить Wordpress до версии 5.2, но перед этим сделал резервную копию...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
2
Ответ Создать тему
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru