Форум программистов, компьютерный форум, киберфорум
Pascal ABC
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.96/54: Рейтинг темы: голосов - 54, средняя оценка - 4.96
1 / 1 / 0
Регистрация: 01.03.2013
Сообщений: 17

Ошибка:Ожидался идентификатор

08.04.2013, 18:57. Показов 10804. Ответов 3
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
Pascal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
type
  PTClient = ^TClient;
  TClient = object;
 
    constructor create(value: integer);
    function get_id: integer;
 
  private
    ID: integer;
  end;
 
constructor TClient.create(value: integer);
begin
  ID := value;
end;
function TClient.get_id: integer;
begin
  get_id := ID;
end;
Выдает
Ошибка:Ожидался идентификатор
вот в этом месте:
constructor create(тут value: integer);
function get_id: integer;
0
IT_Exp
Эксперт
34794 / 4073 / 2104
Регистрация: 17.06.2006
Сообщений: 32,602
Блог
08.04.2013, 18:57
Ответы с готовыми решениями:

Ошибка: ожидался идентификатор
var a:array of array of Integer; n,x,i,j:integer; begin Write('N='); Readln(n); SetLength(a,n,n); x:=n; ...

Ошибка "ожидался идентификатор"
Шифр состоит из двух частей: зашифрованного сообщения и ключа к нему. Зашифрованное сообщение и ключ объединялись в одно сообщение, которое...

Ожидался идентификатор в функции
Всем привет. function OI1R(Igrok:integer); var n:integer; igr:string; begin igrok:=0 randomize; igrok:=random(n); igr:=d;

3
Почетный модератор
 Аватар для Puporev
64314 / 47610 / 32743
Регистрация: 18.05.2008
Сообщений: 115,168
08.04.2013, 19:15
Напишите вместо object -> class
Pascal
1
2
3
4
5
type
  PTClient = ^TClient;
  TClient = class
  constructor Create(value:integer);
  function get_id: integer;
1
1 / 1 / 0
Регистрация: 01.03.2013
Сообщений: 17
08.04.2013, 23:03  [ТС]
Puporev, Спасибо,исправил,но далее опять возникают сложности.Если не трудно посмотрите ошибки:
Pascal
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
Program bank;
const
  n  = 10;
  n5 =  6;
  n6 =  3;
  nT = 50;
 
function f1: integer;
begin
  f1 := random(4) + 2;
end;
function f2: integer;
begin
  f2 := random(10);
end;
 
(***** TClient *****)
type
  PTClient = ^TClient;
  TClient = class
 
    constructor create(value: integer);
    function get_id: integer;
 
  private
    ID: integer;
  end;
 
constructor TClient.create(value: integer);
begin
  ID := value;
end;
function TClient.get_id: integer;
begin
  get_id := ID;
end;
 
 
type
  T = PTClient;
 
  PTQueueItem = ^TQueueItem;
  TQueueItem = class
    item: T;
    next: PTQueueItem;
 
    constructor create(value: T);
  end;
 
  TQueue = class
    constructor create;
    destructor destroy;
 
    procedure get(var value: T);
    procedure put(const value: T);
 
    function is_empty: boolean;
 
  private
    front, back: PTQueueItem;
  end;
 
 
 
constructor TQueueItem.create(value: T);
begin
  item := value;
  next := nil;
end;
 
constructor TQueue.create;
begin
  front := nil; back := nil;
end;
 
destructor TQueue.destroy;
var value: T;
begin
  while not is_empty do get(value);
end;
 
procedure TQueue.get(var value: T);
var pt: PTQueueItem;
begin
  if is_empty then begin
    writeln('Trying to Get from the empty queue !'); halt(101)
  end;
 
  pt := front;
  front := front^.next;
 
  value := pt^.item;
  dispose(pt);
end;
 
 
procedure TQueue.put(const value: T);
var pt: PTQueueItem;
begin
  pt := new(PTQueueItem, create(value));
  if is_empty then begin
    front := pt; back := pt;
  end
  else begin
    back^.next := pt;
    back := pt;
  end;
end;
 
 
function TQueue.is_empty: boolean;
begin
  is_empty := (front = nil)
end;
 
 
type
  status = (
    _busy = 0, _waiting, _vacation
  );
 
  PTCasher = ^TCasher;
  TCasher = object
 
    state: status;
    work_time, ID: integer; { *** const *** }
    working_time, this_client: integer;
 
  public
    constructor create(_id, _work: integer);
    function handle(var changed: integer): status;
    procedure next;
  end;
 
 
constructor TCasher.create(_id, _work: integer);
begin
  ID := _id; work_time := _work; state := _waiting;
 
  working_time := work_time;
end;
 
function TCasher.handle(var changed: integer): status;
begin
  changed := 0;
 
  if state = _busy then begin
    dec(this_client);
    dec(working_time);
 
    if this_client = 0 then begin
      state := _waiting; changed := 1;
    end;
  end;
 
  if state = _vacation then begin
    inc(working_time);
    if working_time > 0 then begin
      state := _waiting; working_time := work_time; changed := 1;
    end;
  end;
 
  if state = _waiting then begin
    if changed = 0 then dec(working_time);
    if working_time <= 0 then begin
      state := _vacation; working_time := -n6; changed := 1;
    end;
  end;
 
  handle := state;
end;
 
procedure TCasher.next;
begin
  state := _busy;
  this_client := f2;
end;
 
 
type
  TManager = object
    queue: TQueue;
    cash_workers: array[0 .. pred(n)] of PTCasher;
 
    current_time, after_prev_enter: integer;
 
  public
    constructor create;
    destructor destroy;
 
    procedure run;
  end;
 
constructor TManager.create;
var i: integer;
begin
  current_time := 0; after_prev_enter := 0;
  for i := 0 to pred(n) do
    cash_workers[i] := new(PTCasher, create(i + 1, n5));
end;
 
destructor TManager.destroy;
var i: integer;
begin
  for i := 0 to pred(n) do
    dispose(cash_workers[i]);
end;
 
procedure TManager.run;
const
  client_entered: integer = 0;
var
  i: integer;
  status_changed: integer;
  curr_status: status;
  client: PTClient;
begin
 
  while (current_time <= nT) or (not queue.is_empty) do begin
 
    for i := 0 to pred(n) do begin
      status_changed := 0;
      curr_status := cash_workers[i]^.Handle(status_changed);
 
      if status_changed <> 0 then { statistics }
        case curr_status of
          _vacation:
            writeln('casher #', i, ' goes to rest at:: ', current_time);
          _waiting:
            writeln('casher #', i, ' awaiting at:: ', current_time);
        end;
 
      if curr_status = _waiting then
        if not queue.is_empty then begin
 
          queue.get(client);
          writeln('client #', client^.get_id, ' sent to casher #', i, ' at:: ', current_time);
          cash_workers[i]^.next;
          dispose(client);
 
        end;
 
    end;
 
    if current_time <= nT then begin
 
      inc(after_prev_enter);
      if after_prev_enter > f1 then begin
 
        after_prev_enter := 0;
        inc(client_entered);
        client := new(PTClient, create(client_entered));
        queue.put(client);
 
      end;
 
    end;
    inc(current_time);
  end;
  writeln(client_entered);
 
end;
 
var bank: TManager;
begin
 
  bank.create;
  bank.run;
  bank.destroy;
end.
0
Почетный модератор
 Аватар для Puporev
64314 / 47610 / 32743
Регистрация: 18.05.2008
Сообщений: 115,168
09.06.2016, 14:20
Строка 5, нужно begin, а не Beпin
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
BasicMan
Эксперт
29316 / 5623 / 2384
Регистрация: 17.02.2009
Сообщений: 30,364
Блог
09.06.2016, 14:20
Помогаю со студенческими работами здесь

Встречено 'for', а ожидался идентификатор
Помогите пожалуйста найти и исправить ошибки в приведенном коде. Написанный от руки код мне дали, что бы я внес в него данные и...

Ошбика: ожидался идентификатор
Uses crt; Var a:array of record name:string; time1,time2,num:integer; end; f:array of record ...

Ожидался идентификатор, но C не обнаружено
Program M; Type product=(milk,sugar,tea,salt,butter,eggs,marmalade,bacon); mnprod=set of product; Var C,A,B,MR,MP:mnprod; ...

Встречено 'case', а ожидался идентификатор
При компиляции пишет: &quot;Встречено 'case', а ожидался идентификатор.&quot; В чем может быть ошибка? Const marka: array of...

Program1.pas(34) : Встречено 'begin', а ожидался идентификатор
34 строка uses GraphABC, events; var a,i: integer; B:array of string; // B - это массив для пунктов меню ...


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

Или воспользуйтесь поиском по форуму:
4
Ответ Создать тему
Новые блоги и статьи
моя боль
iceja 24.01.2026
Выложила интерполяцию кубическими сплайнами www. iceja. net REST сервисы временно не работают, только через Web. Написала за 56 рабочих часов этот сайт с нуля. При помощи perplexity. ai PRO , при. . .
Модель сукцессии микоризы
anaschu 24.01.2026
Решили писать научную статью с неким РОманом
http://iceja.net/ математические сервисы
iceja 20.01.2026
Обновила свой сайт http:/ / iceja. net/ , приделала Fast Fourier Transform экстраполяцию сигналов. Однако предсказывает далеко не каждый сигнал (см ограничения http:/ / iceja. net/ fourier/ docs ). Также. . .
http://iceja.net/ сервер решения полиномов
iceja 18.01.2026
Выкатила http:/ / iceja. net/ сервер решения полиномов (находит действительные корни полиномов методом Штурма). На сайте документация по API, но скажу прямо VPS слабенький и 200 000 полиномов. . .
Расчёт переходных процессов в цепи постоянного тока
igorrr37 16.01.2026
/ * Дана цепь(не выше 3-го порядка) постоянного тока с элементами R, L, C, k(ключ), U, E, J. Программа находит переходные токи и напряжения на элементах схемы классическим методом(1 и 2 з-ны. . .
Восстановить юзерскрипты Greasemonkey из бэкапа браузера
damix 15.01.2026
Если восстановить из бэкапа профиль Firefox после переустановки винды, то список юзерскриптов в Greasemonkey будет пустым. Но восстановить их можно так. Для этого понадобится консольная утилита. . .
Сукцессия микоризы: основная теория в виде двух уравнений.
anaschu 11.01.2026
https:/ / rutube. ru/ video/ 7a537f578d808e67a3c6fd818a44a5c4/
WordPad для Windows 11
Jel 10.01.2026
WordPad для Windows 11 — это приложение, которое восстанавливает классический текстовый редактор WordPad в операционной системе Windows 11. После того как Microsoft исключила WordPad из. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru