0 / 0 / 0
Регистрация: 05.01.2010
Сообщений: 25
1

Симплекс-метод, планирование производства

26.05.2011, 19:20. Показов 1780. Ответов 8
Метки нет (Все метки)

Author24 — интернет-сервис помощи студентам
Написал программу,но выдаёт ошибку "is not a valid floating point value" при нажатии кнопки "Далее" и ругается на процедуру Otvet. Не пойму в чем проблема,прошу кого нибудь проверить код:
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
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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
unit Unit2;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ComCtrls, ExtCtrls, Grids;
 
type
  TForm2 = class(TForm)
    Panel1: TPanel;
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Label3: TLabel;
    Edit2: TEdit;
    RichEdit1: TRichEdit;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn3: TBitBtn;
    StringGrid1: TStringGrid;
    Panel2: TPanel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Edit3: TEdit;
    Edit4: TEdit;
    BitBtn8: TBitBtn;
    BitBtn9: TBitBtn;
    BitBtn10: TBitBtn;
    GroupBox1: TGroupBox;
    BitBtn11: TBitBtn;
    Button2: TButton;
    BitBtn12: TBitBtn;
    BitBtn13: TBitBtn;
    BitBtn14: TBitBtn;
    StringGrid2: TStringGrid;
    Panel3: TPanel;
    Label7: TLabel;
    StringGrid3: TStringGrid;
    Panel4: TPanel;
    Label8: TLabel;
    StringGrid4: TStringGrid;
    Panel5: TPanel;
    Label9: TLabel;
    Memo1: TMemo;
    Label10: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure Edit2KeyPress(Sender: TObject; var Key: Char);
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure BitBtn11Click(Sender: TObject);
    procedure BitBtn14Click(Sender: TObject);
    procedure BitBtn8Click(Sender: TObject);
    procedure BitBtn9Click(Sender: TObject);
    procedure BitBtn10Click(Sender: TObject);
    procedure BitBtn13Click(Sender: TObject);
    procedure BitBtn12Click(Sender: TObject);
 
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form2: TForm2;
 
implementation
 
{$R *.dfm}
procedure dvSimplexMetod(n:boolean);
var
  Count,Count1,MinC,MinR:integer;
  MinEl,zna4,zna4TMP,zna4TMP2:double;
  b,reshil,dv:boolean;
begin
  reshil:=false;
  dv:=form2.RadioButton2.Checked;
repeat
 b:=false;
 for count:=2 to form2.StringGrid4.ColCount-1 do
     if strtofloat(form2.StringGrid4.Cells [count,1])<0 then b:=true;
 for count:=2 to form2.StringGrid4.RowCount-1 do
     if strtofloat(form2.StringGrid4.Cells[1,count])<0 then b:=true;
 
  if b then
     begin
      MinR:=2;
      zna4:=strtofloat(form2.StringGrid4.Cells[1,2]);
      for count:=2 to form2.StringGrid4.RowCount-1 do
       if strtofloat(form2.StringGrid4.Cells[1,count])<zna4 then
        begin
          zna4:=strtofloat(form2.StringGrid4.Cells[1,count]);
          MinR:=count;
        end;
       zna4TMP:=strtofloat(form2.StringGrid4.Cells[2,1]);
       zna4TMP2:=strtofloat(form2.StringGrid4.Cells[2,MinR]);
       MinEl:=zna4TMP/zna4TMP2;
       MinC:=2;
      for Count:=2 to form2.StringGrid4.ColCount-1 do
        begin
          zna4TMP:=strtofloat(form2.StringGrid4.Cells[count,1]);
          zna4TMP2:=strtofloat(form2.StringGrid4.Cells[count,MinR]);
            if (zna4TMP>0) and (zna4TMP2<0) then
              begin
                zna4:=zna4TMP/zna4TMP2;
                if abs(zna4)<abs(MinEl) then
                  begin
                    MinEl:=zna4;
                    MinC:=Count;
                  end;
              end;
        end;
 
  MinEl:=strtofloat(form2.StringGrid4.Cells[MinC,MinR]);
    for count:=1 to form2.StringGrid4.ColCount-1 do
      form2.StringGrid4.Cells[count,MinR]:=floattostr(strtofloat(form2.StringGrid4.Cells[count,MinR])/MinEl);
 
    for count:=1 to form2.StringGrid4.ColCount-1 do
      for Count1:=1 to form2.StringGrid4.RowCount-1 do
        if (count<>MinC)and(count1<>MinR) then
          form2.StringGrid4.Cells[count,count1]:=floattostr(strtofloat(form2.StringGrid4.Cells[count,count1])-strtofloat(form2.StringGrid4.Cells[count,MinR])*strtofloat(form2.StringGrid4.Cells[MinC,count1]));
 
  form2.StringGrid4.Cells[0,MinR]:=form2.StringGrid4.Cells[MinC,0];
    for count:=1 to form2.StringGrid4.RowCount-1 do
      if form2.StringGrid4.Cells[MinC,0]=form2.StringGrid4.Cells[0,count] then
        form2.StringGrid4.Cells[MinC,count]:='1'
      else
        form2.StringGrid4.Cells[MinC,count]:='0';
 
    end
  else
    begin
      form2.Label10.Caption:='Ðåøåíèå íàéäåíî!';
      reshil:=true;
    end;
  until reshil or n;
  end;
 
procedure SimplexMetod(n:boolean);
var
  Count,Count1,MinC,MinR:integer;
  MinEl,zna4,zna4TMP,zna4TMP2:double;
  b,reshil:boolean;
begin
  reshil:=false;
repeat
 b:=false;
  for count:=1 to form2.StringGrid4.ColCount-1 do
    if strtofloat(form2.StringGrid4.Cells[count,1])<0 then b:=true;
 
    if b then
      begin
        MinC:=2;
        zna4:=strtofloat(form2.StringGrid4.Cells[2,1]);
          for count:=2 to form2.StringGrid4.ColCount-1 do
            if strtofloat(form2.StringGrid4.Cells[count,1])<zna4 then
              begin
                zna4:=strtofloat(form2.StringGrid4.Cells[count,1]);
                MinC:=count;
              end;
            zna4TMP:=strtofloat(form2.StringGrid4.Cells[1,2]);
            zna4TMP2:=strtofloat(form2.StringGrid4.Cells[MinC,2]);
            MinEl:=zna4TMP/zna4TMP2;
            MinR:=2;
          for Count:=2 to form2.StringGrid4.RowCount-1 do
            begin
              zna4TMP:=strtofloat(form2.StringGrid4.Cells[1,count]);
              zna4TMP2:=strtofloat(form2.StringGrid4.Cells[MinC,count]);
                if zna4TMP2>0 then
                  begin
                    zna4:=zna4TMP/zna4TMP2;
                    if zna4<MinEl then
                      begin
                        MinEl:=zna4;
                        MinR:=Count;
                      end;
                  end;
            end;
 
  MinEl:=strtofloat(form2.StringGrid4.Cells[MinC,MinR]);
    for count:=1 to form2.StringGrid4.ColCount-1 do
      form2.StringGrid4.Cells[count,MinR]:=floattostr(strtofloat(form2.StringGrid4.Cells[count,MinR])/MinEl);
 
    for count:=1 to form2.StringGrid4.ColCount-1 do
      for Count1:=1 to form2.StringGrid4.RowCount-1 do
        if (count<>MinC)and(count1<>MinR) then
          form2.StringGrid4.Cells[count,count1]:=floattostr(strtofloat(form2.StringGrid4.Cells[count,count1])-strtofloat(form2.StringGrid4.Cells[count,MinR])*strtofloat(form2.StringGrid4.Cells[MinC,count1]));
 
  form2.StringGrid4.Cells[0,MinR]:=form2.StringGrid4.Cells[MinC,0];
    for count:=1 to form2.StringGrid4.RowCount-1 do
      if form2.StringGrid4.Cells[MinC,0]=form2.StringGrid4.Cells[0,count] then
        form2.StringGrid4.Cells[MinC,count]:='1'
      else
        form2.StringGrid4.Cells[MinC,count]:='0';
      end
      else
        begin
          form2.Label10.Caption:='Ðåøåíèå íàéäåíî!';
          reshil:=true;
        end;
      until reshil or n;
end;
 
procedure Ochistka();
begin
  form2.stringgrid1.RowCount:=2;
  form2.stringgrid1.Cells[0,form2.stringgrid1.RowCount-1]:='';
  form2.stringgrid1.Cells[1,form2.stringgrid1.RowCount-1]:='';
  form2.stringgrid2.RowCount:=2;
  form2.stringgrid2.Cells[0,form2.stringgrid2.RowCount-1]:='';
  form2.stringgrid2.Cells[1,form2.stringgrid2.RowCount-1]:='';
  form2.stringgrid3.RowCount:=2;
  form2.stringgrid2.Cells[0,form2.stringgrid2.RowCount-1]:='';
  form2.stringgrid2.Cells[1,form2.stringgrid2.RowCount-1]:='';
  form2.stringgrid3.ColCount:=2;
  form2.stringgrid3.RowCount:=2;
end;
 
function Proverka():boolean;
var
  Count,Count1:integer;
  b:boolean;
begin
  b:=true;
  form2.StringGrid3.Cells[1,1]:='0';
    for Count:=1 to form2.StringGrid3.RowCount-1 do
      for Count1:=1 to form2.StringGrid3.ColCount-1 do
        if form2.StringGrid3.Cells[Count1,Count]='' then
          begin
            b:=false;
            form2.Label10.Caption:='Îøèáêà çàïîëíåíèÿ òàáëèöû. Íàéäåíî ïóñòîå ïîëå!';
          end;
  proverka:=b;
 
end;
 
procedure ZapEnd();
var
  Count,count1,tmp,k:integer;
begin
  k:=1;
    if form2.RadioButton2.Checked then k:=-1;
      form2.StringGrid4.RowCount:=form2.StringGrid3.RowCount;
      form2.StringGrid4.ColCount:=form2.StringGrid3.ColCount;
        for count:=0 to form2.StringGrid3.RowCount-1 do
        for count1:=0 to form2.StringGrid3.ColCount-1 do
            form2.StringGrid4.Cells [Count1,count]:=form2.StringGrid3.Cells[Count1,count];
        for count:=1 to form2.StringGrid3.RowCount-1 do
        for count1:=1 to form2.StringGrid3.ColCount-1 do
            form2.StringGrid4.Cells [Count1,count]:=floattostr(k*strtofloat(form2.StringGrid3.Cells[Count1,count]));
        for count:=1 to form2.StringGrid4.ColCount-1 do
            form2.StringGrid4.Cells[count,1]:=floattostr(strtofloat(form2.StringGrid4.Cells[count,1])*(-1));
    tmp:=form2.StringGrid4.ColCount;
    form2.StringGrid4.ColCount:=tmp+form2.StringGrid3.RowCount-2;
      for Count:=2 to form2.StringGrid3.RowCount-1 do
        begin
          form2.StringGrid4.Cells[count+tmp-2,0]:=form2.StringGrid3.Cells[0,count];
        end;
      for count:=tmp to form2.StringGrid4.ColCount-1 do
      for count1:=1 to form2.StringGrid4.RowCount-1 do
        if form2.StringGrid4.Cells[count,0]=form2.StringGrid4.Cells[0,count1] then
          form2.StringGrid4.Cells[count,count1]:='1'
        else
          form2.StringGrid4.Cells[count,count1]:='0';
 
end;
 
procedure zapolnenie();
var
  Count:integer;
begin
  form2.StringGrid3.Cells[1,0]:='Îáù.Ôîíä';
    for Count:=1 to form2.stringgrid1.RowCount-1 do
      begin
        form2.StringGrid3.RowCount:=form2.StringGrid3.RowCount+1;
        form2.StringGrid3.Cells[0,Count+1]:=form2.StringGrid1.Cells[0,Count];
      end;
        form2.StringGrid3.Cells[0,1]:='Ïðèáûëü';
        form2.StringGrid3.Cells[1,1]:='0';
          for Count:=1 to form2.stringgrid2.RowCount-1 do
            begin
              form2.StringGrid3.ColCount:=form2.StringGrid3.ColCount+1;
              form2.StringGrid3.Cells[Count+1,0]:=form2.StringGrid2.Cells[0,Count];
            end;
          for Count:=1 to form2.StringGrid1.RowCount-1 do
              form2.StringGrid3.Cells[1,Count+1]:=form2.StringGrid1.Cells[1,Count];
          for Count:=1 to form2.StringGrid2.RowCount-1 do
              form2.StringGrid3.Cells[Count+1,1]:=form2.StringGrid2.Cells[1,Count];
end;
 
procedure Otvet();
var
  count,count1:integer;
  b:boolean;
begin
    form2.Memo1.Lines.Add('Âûãîäíî ïðîèçâîäèòü/èñïîëüçîâàòü ñëåäóþùóþ ïðîäóêöèþ:');
    for count:=1 to form2.StringGrid4.RowCount-1 do
        for count1:=0 to form2.StringGrid2.RowCount-1 do
            if form2.StringGrid4.Cells[0,count]=form2.StringGrid2.Cells[0,count1] then
            begin
                form2.Memo1.Lines.Add(form2.StringGrid4.Cells[0,count]+' â êîëè÷åñòâå '+form2.StringGrid4.Cells[1,count]+' åä.');
            end;
    b:=false;
    for count:=1 to form2.StringGrid4.RowCount -1 do
        for count1:=0 to form2.StringGrid1.RowCount -1 do
            if form2.StringGrid4.Cells[0,count]=form2.StringGrid1.Cells[0,count1] then
            begin
              b:=true;
              break;
            end;
    if b then
    begin
     form2.Memo1.Lines.Add('');
     form2.Memo1.Lines.Add('Ïðè ýòîì áóäóò òàêèå èçëèøêè ðåñóðñîâ:');
     for count:=1 to form2.StringGrid4.RowCount-1 do
         for count1:=0 to form2.StringGrid1.RowCount-1 do
             if form2.StringGrid4.Cells[0,count]=form2.StringGrid1.Cells[0,count1] then
             begin
                 form2.Memo1.Lines.Add(form2.StringGrid4.Cells[0,count]+' â êîëè÷åñòâå '+form2.StringGrid4.Cells[1,count]+' åä.');
             end;
    end;
    form2.Memo1.Lines.Add('');
    if form2.RadioButton2.Checked then
      form2.Memo1.Lines.Add('Çàòðàòû ïðè òàêîì ïëàíå èñïîëüçîâàíèÿ ñîñòàâÿò '+floattostr((-1)*strtofloat(form2.StringGrid4.Cells[1,1]))+' ó.å.')
    else
      form2.Memo1.Lines.Add('Ïðèáûëü ïðè òàêîì ïëàíå ïðîèçâîäñòâà ñîñòàâèò '+form2.StringGrid4.Cells[1,1]+' ó.å.');
end;
 
procedure TForm2.FormCreate(Sender: TObject);
begin
  bitbtn13.Enabled:=false;
  stringgrid1.Cells[0,0]:='Íàèìåíîâàíèå ðåñóðñà';
  stringgrid1.Cells[1,0]:='Îáù. Ôîíä';
  stringgrid2.Cells[0,0]:='Íàèìåíîâàíèå ïðîäóêòà';
  stringgrid2.Cells[1,0]:='Ñòîèìîñòü';
end;
 
procedure TForm2.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
  case key of
          #8: ;
          #46:;
          '0'..'9': ;
        else key:=#0;
        end;
end;
 
procedure TForm2.BitBtn1Click(Sender: TObject);
var
  Count:integer;
  b:boolean;
begin
  b:=true;
  if (edit1.Text='')or(edit2.Text='') then
    begin
      b:=false;
      label10.Caption:='Çàïîëíèòå âñå ïîëÿ ââîäà!';
    end;
 
    for Count:=1 to stringgrid1.RowCount do
      begin
        if (edit1.Text=stringgrid1.Cells[0,Count]) then
        b:=false;
      end;
    if b then
      begin
        if (stringgrid1.RowCount=2) and (stringgrid1.Cells[0,1]='')  then
        stringgrid1.RowCount:=stringgrid1.RowCount
        else
        stringgrid1.RowCount:=stringgrid1.RowCount + 1;
        stringgrid1.Cells[0,stringgrid1.RowCount-1]:=edit1.Text;
        stringgrid1.Cells[1,stringgrid1.RowCount-1]:=edit2.Text;
        label10.Caption:='Ðåñóðñ äîáàâëåí!'
        end
        else
          label10.Caption:='Òàêîé ðåñóðñ óæå ñóùåñòâóåò!'
 
end;
 
procedure TForm2.BitBtn2Click(Sender: TObject);
var
  Count,i:integer;
  b:boolean;
begin
  b:=true;
  for Count:=1 to stringgrid1.RowCount do
    begin
      if (edit1.Text=stringgrid1.Cells[0,Count]) then
        begin
          i:=Count;
          b:=false;
        end;
    end;
    if b then
      begin
        label10.Caption:='Òàêîãî ðåñóðñà íåò â ñïèñêå!';
      end
      else
        begin
          stringgrid1.Cells[0,i]:=edit1.Text;
          stringgrid1.Cells[1,i]:=edit2.Text;
          label10.Caption:='Ðåñóðñ èçìåíåí!';
        end;
end;
 
procedure TForm2.BitBtn3Click(Sender: TObject);
var
  Count,i:integer;
  b:boolean;
 
begin
   b:=true;
   for Count:=1 to stringgrid1.RowCount do
    begin
      if (edit1.Text=stringgrid1.Cells[0,Count]) then
        begin
          i:=Count;
          b:=false;
        end;
    end;
   if b then
    begin
      label10.Caption:='Òàêîãî ðåñóðñà íåò â ñïèñêå!';
    end
    else
      begin
        stringgrid1.Rows[i].Clear ;
        for Count:=i to stringgrid1.RowCount-1 do
          begin
            stringgrid1.Cells[0,Count]:=stringgrid1.Cells[0,Count+1];
            stringgrid1.Cells[1,Count]:=stringgrid1.Cells[1,Count+1];
          end;
        stringgrid1.RowCount:=stringgrid1.RowCount-1;
        label10.Caption:='Ðåñóðñ ñòåðò!';
      end;
end;
 
procedure TForm2.BitBtn11Click(Sender: TObject);
begin
  form2.close;
end;
 
procedure TForm2.BitBtn14Click(Sender: TObject);
begin
  label10.Caption:='';
  if Panel4.Visible=true then
        begin
          Panel4.Visible:=false;
          Panel5.Visible:=true;
          bitbtn12.Visible:=false;
          memo1.Clear();
          bitbtn14.Enabled:=false;
            if form2.RadioButton2.Checked then
              dvSimplexMetod(False)
            else
              SimplexMetod(False);
              Otvet();
        end;
          if Panel3.Visible=true then
            begin
              if Proverka() then
                begin
                  Panel3.Visible:=false;
                  Panel4.Visible:=true;
                  bitbtn12.Visible:=true;
                  bitbtn14.Caption:= '<Îòâåò>';
                  zapend();
                end;
            end;
          if Panel2.Visible=true then
            begin
              if stringgrid2.Cells[0,1]<>'' then
                begin
                  Panel2.Visible:=false;
                  Panel3.Visible:=true;
                  stringgrid3.ColCount:=2;
                  stringgrid3.RowCount:=2;
                  zapolnenie();
                end
              else label10.Caption:='Ïðîäóêòîâ íåò!';
            end;
          if Panel1.Visible=true then
            begin
              if stringgrid1.Cells[0,1]<>'' then
                begin
                  bitbtn13.Enabled:=true;
                  Panel1.Visible:=false;
                  Panel2.Visible:=true;
                end
              else label10.Caption:='Ðåñóðñû íå ìîãóò îòñóòñòâîâàòü!';
            end;
end;
 
procedure TForm2.BitBtn8Click(Sender: TObject);
var
  Count:integer;
  b:boolean;
begin
  b:=true;
  if (edit3.Text='')or(edit4.Text='') then
    begin
      b:=false;
      label10.Caption:='Çàïîëíèòå âñå ïîëÿ ââîäà!';
    end;
    for Count:=1 to stringgrid2.RowCount do
      begin
        if (edit3.Text=stringgrid2.Cells[0,Count]) then
        b:=false;
      end;
    if b then
      begin
        if (stringgrid2.RowCount=2) and (stringgrid2.Cells[0,1]='')  then
        stringgrid2.RowCount:=stringgrid2.RowCount
    else
      stringgrid2.RowCount:=stringgrid2.RowCount+1;
      stringgrid2.Cells[0,stringgrid2.RowCount-1]:=edit3.Text;
      stringgrid2.Cells[1,stringgrid2.RowCount-1]:=edit4.Text;
      label10.Caption:='Ïðîäóêò äîáàâëåí!';
    end
    else
      label10.Caption:='Òàêîé ïðîäóêò óæå åñòü!';
end;
 
procedure TForm2.BitBtn9Click(Sender: TObject);
var
  Count,i:integer;
  b:boolean;
begin
  b:=true;
  for Count:=1 to stringgrid2.RowCount do
    begin
      if (edit3.Text=stringgrid2.Cells[0,Count]) then
        begin
          i:=Count;
          b:=false;
        end;
    end;
    if b then
      begin
        label10.Caption:='Òàêîãî ïðîäóêòà íåò â ñïèñêå!';
      end
    else
      begin
        stringgrid2.Cells[0,i]:=edit3.Text;
        stringgrid2.Cells[1,i]:=edit4.Text;
        label10.Caption:='Ïðîäóêò èçìåíåí!';
end;
 
end;
 
procedure TForm2.BitBtn10Click(Sender: TObject);
var
  Count,i:integer;
  b:boolean;
begin
  b:=true;
  for Count:=1 to stringgrid2.RowCount do
    begin
      if (edit3.Text=stringgrid2.Cells[0,Count]) then
        begin
          i:=Count;
          b:=false;
        end;
    end;
    if b then
      begin
        label10.Caption:='Òàêîãî ïðîäóêòà íåò â ñïèñêå!';
      end
    else
      begin
        stringgrid2.Rows[i].Clear ;
        for Count:=i to stringgrid2.RowCount-1 do
          begin
            stringgrid2.Cells[0,Count]:=stringgrid2.Cells[0,Count+1];
            stringgrid2.Cells[1,Count]:=stringgrid2.Cells[1,Count+1];
          end;
        stringgrid2.RowCount := stringgrid2.RowCount -1;
        label10.Caption:='Ïðîäóêò ñòåðò!';
      end;
 
end;
 
procedure TForm2.BitBtn13Click(Sender: TObject);
begin
  label10.Caption:='';
    if Panel2.Visible=true then
      begin
        bitbtn13.Enabled:=false;
        Panel2.Visible:=false;
        Panel1.Visible:=true;
      end;
      if Panel3.Visible=true then
        begin
          Panel3.Visible:=false;
          Panel2.Visible:=true;
        end;
      if Panel4.Visible=true then
        begin
          Panel4.Visible:=false;
          Panel3.Visible:=true;
          bitbtn12.Visible:=false;
          bitbtn14.Caption:='Äàëåå ==>';
          bitbtn14.Enabled:=true;
        end;
      if Panel5.Visible=true then
        begin
          Panel5.Visible:=false;
          Panel4.Visible:=true;
          bitbtn12.Visible:=true;
          bitbtn14.Enabled:=true;
        end;
end;
 
 
procedure TForm2.BitBtn12Click(Sender: TObject);
begin
  if form2.RadioButton2.Checked then
    dvSimplexMetod(True)
  else
    SimplexMetod(True);
end;
 
end.
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
26.05.2011, 19:20
Ответы с готовыми решениями:

Симплекс-метод
Здравствуйте, помогите сделать программу на с++ или делфи. Нужно построить симплекс-метод в случае...

Симплекс метод
Здравствуйте! Нужно решить задачу в делфи с использованием симплекс метода. Задание дали на ночь....

Симплекс метод
Есть решенная задача Надо переделать под задание вот само задание Фармацевтическая...

Симплекс М-Метод
Здравствуйте. Обращаюсь к вам за помощью. Суть проблемы такова....Нужна программка для...

8
3217 / 2360 / 540
Регистрация: 11.09.2009
Сообщений: 8,597
26.05.2011, 21:50 2
dimkaiceman, ошибка "is not a valid floating point value" обычно получается, когда в проверяемой строке записано не число или десятичный разделитель не соответствует установленному в системе (обычно запятая вместо точки или наоборот).
0
0 / 0 / 0
Регистрация: 05.01.2010
Сообщений: 25
26.05.2011, 23:29  [ТС] 3
не совсем понятно это...а не сможешь помочь найти это место где происходит эта ошибка? я читал что обычно в стринггридах такие косяки бывают,хотя проверял-вроде всё правильно
0
324 / 316 / 84
Регистрация: 03.03.2010
Сообщений: 1,364
27.05.2011, 00:30 4
dimkaiceman, попробуй переменной zna4 поменять тип на real.
а вообще берёшь ставишь курсором красную точку левее кода на кнопке при нажатии которой происходит ошибка, запускаешь проект нажимаешь на ту кнопку и после появления кода жмёшь F7 пока не выскачет ошибка. это самый верный способ найти её
0
0 / 0 / 0
Регистрация: 05.01.2010
Сообщений: 25
27.05.2011, 13:34  [ТС] 5
Попробовал как ты посоветовал-нашел ошибку в 154 строке:
Delphi
1
if strtofloat(form2.StringGrid4.Cells[count,1])<0 then b:=true;
а вот че не так тут-ума не приложу
0
3217 / 2360 / 540
Регистрация: 11.09.2009
Сообщений: 8,597
27.05.2011, 16:06 6
Цитата Сообщение от dimkaiceman Посмотреть сообщение
form2.StringGrid4.Cells[count,1]
Что написано в этой ячейке?
Какой десятичный разделитель установлен в вашей системе? (Пуск > Панель управления > Язык и региональные стандарты > закладка "Региональные параметры" > Настройка > Числа > Разделитель целой и дробной части)
0
0 / 0 / 0
Регистрация: 05.01.2010
Сообщений: 25
27.05.2011, 19:20  [ТС] 7
Разделитель стоит точка.
А насчет того что в этой ячейке не знаю,позже проверю,отпишусь
0
0 / 0 / 0
Регистрация: 05.01.2010
Сообщений: 25
30.05.2011, 12:44  [ТС] 8
При нажатии кнопки далее в эту ячейку ничего не заносится
0
324 / 316 / 84
Регистрация: 03.03.2010
Сообщений: 1,364
30.05.2011, 18:23 9
а еслт там нет значения то он не может его сравнить с числом. попробуй так если там не будет числа то он сам поставит -1
Delphi
1
if strtofloatDef((form2.StringGrid4.Cells[count,1],-1))<0 then b:=true;
0
30.05.2011, 18:23
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
30.05.2011, 18:23
Помогаю со студенческими работами здесь

Симплекс метод
Нужна программа для курсового на решение задач симплекс методом в случае положительных свободных...

Симплекс метод - ошибка на ELSE
Пишу программу для региная ЛЗП симплекс методом. Выдает ошибку на ветвь ELSE что делать не знавю,...

Двойственный симплекс метод
Наверно этот вопрос уже был. Срочно нужен исходник реализующий двойственный симплекс метод. ...

Модифицированный симплекс-метод
Помогите найти информацию про модифицированный симплекс-метод


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

Или воспользуйтесь поиском по форуму:
9
Ответ Создать тему
Опции темы

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