Ошибка raised exception class

DimQaaa

0 / 0 / 0

Регистрация: 17.06.2014

Сообщений: 59

1

23.11.2014, 14:35. Показов 5122. Ответов 17

Метки нет (Все метки)


Студворк — интернет-сервис помощи студентам

Ребята помогите ошибка «raised exception class econverterror with message is not valid integer value»

Нужно сделать что бы при попадании в цель в label отображались баллы (1,2,3 ..).
Вот код:

Delphi
1
2
3
4
5
6
7
8
9
10
  x:=pula.left;
  y:=pula.Top;
  w:=pula.Width;
  h:=pula.Height;
  x0:=samolet.Left;
  y0:=samolet.Top;
  w0:=samolet.Width;
  h0:=samolet.Height;
 if (x+w>x0) and (x<x0+w0) and (y+h>y0) and (y<y0+h0) then
  result.Caption:=inttostr(strtoInt(result.Caption)+1) ;

Знаю что ошибка в переводе inttostr или strtoint,но не пойму как исправить ее

Помогите пожалуйста.



0



10 / 10 / 5

Регистрация: 26.08.2014

Сообщений: 91

23.11.2014, 15:31

2

ну, вроде должно все работать. При условии что в result.Caption целое чисто. Иначе будет ошибка.
Ну и конечно что result это нечто имеющее свойство Caption.



0



DimQaaa

0 / 0 / 0

Регистрация: 17.06.2014

Сообщений: 59

23.11.2014, 15:34

 [ТС]

3

нет,не как не работало,хоть и даже целое число,я вот исправил чуток он ошибку больше не выдает,но он и прибавлять не хочет,т.е. 1 стоит и все,выше не поднимается:

Delphi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  res:=1;
  x:=pula.left;
  y:=pula.Top;
  w:=pula.Width;
  h:=pula.Height;
  x0:=samolet.Left;
  y0:=samolet.Top;
  w0:=samolet.Width;
  h0:=samolet.Height;
 
  begin
 
   if (x+w>x0) and (x<x0+w0) and (y+h>y0) and (y<y0+h0) then
      result.Caption:=IntToStr(res);
      end;



0



BiHiTRiLL

10 / 10 / 5

Регистрация: 26.08.2014

Сообщений: 91

23.11.2014, 15:36

4

нужно:

Delphi
1
2
if (x+w>x0) and (x<x0+w0) and (y+h>y0) and (y<y0+h0) then res:= res+1;
      result.Caption:=IntToStr(res);



0



DimQaaa

0 / 0 / 0

Регистрация: 17.06.2014

Сообщений: 59

23.11.2014, 15:42

 [ТС]

5

Теперь прибавляет,но как прибавил так и сразу отнял 1.Получается,что я прописал 0,но как только прибавляет 1,так он сразу же начальное значение 0 ставит:

Delphi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
res:=0;
  x:=pula.left;
  y:=pula.Top;
  w:=pula.Width;
  h:=pula.Height;
  x0:=samolet.Left;
  y0:=samolet.Top;
  w0:=samolet.Width;
  h0:=samolet.Height;
  begin
  if (x+w>x0) and (x<x0+w0) and (y+h>y0) and (y<y0+h0) then
  res:= res+1;
  result.Caption:=IntToStr(res);
  end;



0



BiHiTRiLL

10 / 10 / 5

Регистрация: 26.08.2014

Сообщений: 91

23.11.2014, 15:44

6

вот это:

Delphi
1
res:=0;

не должно стоять в процедуре прибавления очков.
иначе каждый раз при вызове этой процедуры ты обнуляешь результат.



0



0 / 0 / 0

Регистрация: 17.06.2014

Сообщений: 59

23.11.2014, 15:47

 [ТС]

7

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



0



10 / 10 / 5

Регистрация: 26.08.2014

Сообщений: 91

23.11.2014, 15:50

8

убирать не нужно. Нужно инициализировать переменную res не в процедуре подсчета очков, а например при старте игры.
ну или сразу в секции объявления переменных.



0



DimQaaa

0 / 0 / 0

Регистрация: 17.06.2014

Сообщений: 59

23.11.2014, 15:51

 [ТС]

9

Вот весь цикл:

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
var
x,y,h,w:integer;
x0,y0,h0,w0 :integer;
res:integer;
begin
pula.Top:=pula.Top-15;
  If pula.top<0 then
  Begin
     tmr2.Interval:=0;
     pula.Visible :=false;
  End;
    x:=pula.left;
  y:=pula.Top;
  w:=pula.Width;
  h:=pula.Height;
  x0:=samolet.Left;
  y0:=samolet.Top;
  w0:=samolet.Width;
  h0:=samolet.Height;
  begin
  if (x+w>x0) and (x<x0+w0) and (y+h>y0) and (y<y0+h0) then
  res:=res+1;
  result.Caption:=IntToStr(res);
  end;



0



BiHiTRiLL

10 / 10 / 5

Регистрация: 26.08.2014

Сообщений: 91

23.11.2014, 15:54

10

Delphi
1
 res:integer =0;



0



DimQaaa

0 / 0 / 0

Регистрация: 17.06.2014

Сообщений: 59

23.11.2014, 15:59

 [ТС]

11

в переменной он ошибку выдает

Добавлено через 2 минуты
Вот смотри даже когда убрал:

Delphi
1
res:=0;

Он высвечивает 112,но все равно прибавляет +1 и сразу же отбавляет опять на 112.



0



10 / 10 / 5

Регистрация: 26.08.2014

Сообщений: 91

23.11.2014, 16:16

12

112 это мусор в данных. локальную переменную помоему нельзя инициализировать. попробуй поставь ее в TForm.Create



1



0 / 0 / 0

Регистрация: 17.06.2014

Сообщений: 59

23.11.2014, 16:18

 [ТС]

13

В глобальную поставил все хорошо не выдает ошибку,но проблема все та же: При попадании прибавляет и сразу же отнимает 1.



0



Пишу на Delphi…иногда

1423 / 1278 / 286

Регистрация: 03.12.2012

Сообщений: 3,914

Записей в блоге: 5

23.11.2014, 16:23

14

Цитата
Сообщение от DimQaaa
Посмотреть сообщение

прибавляет и сразу же отнимает 1.

в приведенном коде только прибавляет — ищи в остальном коде либо строку res:=res-1; либо строку res:=0; на них точку останова, запускай программу и смотри что за чем вызывается и почему



0



0 / 0 / 0

Регистрация: 17.06.2014

Сообщений: 59

23.11.2014, 16:24

 [ТС]

15

Да ладно,пусть будет без очков) Спасибо большое все равно)



0



Пишу на Delphi…иногда

1423 / 1278 / 286

Регистрация: 03.12.2012

Сообщений: 3,914

Записей в блоге: 5

23.11.2014, 16:24

16

Цитата
Сообщение от DimQaaa
Посмотреть сообщение

В глобальную поставил все хорошо

где и как происходит инициализация?



0



0 / 0 / 0

Регистрация: 17.06.2014

Сообщений: 59

23.11.2014, 16:32

 [ТС]

17

Вот ребят сама программа:
Если можете исправьте или доработайте программу,буду очень благодарен.



0



Пишу на Delphi…иногда

1423 / 1278 / 286

Регистрация: 03.12.2012

Сообщений: 3,914

Записей в блоге: 5

23.11.2014, 16:57

18

из всех обработчиков таймера убери объявление локальной переменной res, а также строку res:=0; из tmr3Timer
З.Ы. можно обойтись и одним таймером



0



30K

22 марта 2010 года

Morphling

74 / / 17.01.2010

может я вам не так объяснил, кароч я хотел создать типо калькулятор, к каждой кнопке присвоил caption 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 соответственно. Также есть кнопка «/», «*», «-«, «+» и «=» (без кавычек конечно), которые должны выполнять действие caption. Вот когда я нажимаю на одну из кнопок то в edit1.text появляется собственно caption нажатой кнопки. Например нажал на кнопку «2» «+» «3», в edit1.text появился текст 2 + 3, а потом нажимаю на «=». Вот он должен был мне возвратить 2+3=5, потому что, как я описал выше сначала edit1.text преобразуется в число strtoint(edit1.text), а это в свою очередь присваивается к result, у нас уже это выглядит так
result := strtoint(edit1.text), после этого, result должен посчитать и присвоить значение от 2+3 и вывести на edit1.text (преобразовать целое в строку я не забыл), а он этого не делает и вместо выходит ошибка… Кто понимает, в чем тут проблема?

Topic: Error: Project raised exception class ‘External:SIGSEGV’.  (Read 241354 times)

    I am very excited that I find the Lazarus IDE. I try l open it,run and find an error. Error: Project raised exception class ‘External:SIGSEGV’.
is there something wrong?
thanks.


Logged


    I am very excited that I find the Lazarus IDE. I try l open it,run and find an error. Error: Project raised exception class ‘External:SIGSEGV’.

Run what?

Please give us some additional information:
What OS
32 or 64 bit
Where did you install Lazarus / fpc (in what path)

What happens if you compile, then run the executable outside the IDE

Bart


Logged


    I am very excited that I find the Lazarus IDE. I try l open it,run and find an error. Error: Project raised exception class ‘External:SIGSEGV’.

Run what?

Please give us some additional information:
What OS
32 or 64 bit
Where did you install Lazarus / fpc (in what path)

What happens if you compile, then run the executable outside the IDE

Bart

Hi,
I have the same problem. When I run  (press F9) the project from the IDE, I get the same message.
My environment:
OS: Windows XP 32 bit
I have installed it to the default installation path, wich was recommended by the installer: c:lazarus

Version: lazarus-0.9.26-fpc-2.2.2-win32.exe from sourceforge.

Additional information
However the IDE gives this error message when I try to run the project, it builds the exactly working exe file.

What can be the problem?


Logged


Hello,

I have the same problem. And will try to provide some more information.

System: 3GB ram, Windows XP SP3, with Delphi 7 and Visual Studio 2008
Lazarus: lazarus-0.9.26-fpc-2.2.2-win32 Installed to default directory.
Installation: Full Installation.

Procedure:
— I start Lazarus.
— I press F9. Default lazarus project compiles fine. But gives error right after compilation finishes

Project raised exception class: ‘External: SIGSEGV’

After clicking OK…

Execution Paused
Address: $10009631
Procedure: ??
File:

Notes:
— Often, when I dismiss the second error dialogbox, the execution stays paused. Sometimes however, the executable do fire up and the main form is displayed normally.
— Building and running externally to the IDE causes no exception and the executable performs normally.
— Any project causes this exception. I suspect something to do with the debugger.

More information:

1. Lazarus used to work fine. Error starting showing up after installing Delphi 7 or so I seem to believe. Uninstalling and doing a clean reinstall of Lazarus doesn’t seem to fix the problem. I however cannot at this point try to uninstall Delphi 7 and do a clean Lazarus install to see if the error stays.

2. I remember Delphi saying something about a debugger(jit debugger?) being registered to another application and asking me if I wanted to change this… I cannot remember the exact details of this dialog box. At the time I answered Yes, do register for Delphi 7.

Hope this helps.

« Last Edit: February 02, 2009, 03:29:49 am by marfig »


Logged


It’s the debugger, something wrong with it. To make it more mysterious, only some people have the problem. The other (including me), didn’t have it and everything works flawlessly. I can’t figure out (until now) why. I’ve posted the way I setup my environment, but it doesn’t seem to work for other people. In case you want to know, here it goes:

  • Build FPC and Lazarus from source, fully smartlinked and stripped
  • Build GDB from source, without nls support (+ level 3 optimization and debug info stripping)


Logged


Lazarus uses GDB (from mingw) as debugger.

Unfortunately several (if not most/all) versions of gdb for windows have (afaik/imho) one or another flaw.

The most common case seems to be related to some leak in GDB. This will be experienced as the very first time you run/debug your application (via F9 or menu) it will work, but after that you get all sort of errors.
In this case use «reset debugger» from the «run» menu.

I do not have a list which version of GDB works better or worse or how it depends on your environment. You can always try to download another version from mingw, and see if it does the trick for you.

Good luck


Logged


It seems to be related to Comodo Firewall and would be interesting if anyone experiencing this problem and seeing this could confirm if they have this firewall program installed.

This is what is reported when I try to debug an fpc app from the command line:

Starting program: C:Projectslaz/project1.exe                                                                                                       
[New thread 3040.0xbe8]                                                                                                                               

Program received signal SIGSEGV, Segmentation fault.                                                                                                 
0x10009631 in ?? () from C:WINDOWSsystem32guard32.dll


Logged


And here’s what I did to solve the problem.

guard32.dll seems to be used by Commodo Personal Firewall mostly by it’s Defense+ component. Something I don’t use personally, is disabled, but still attached the dll to all running executables. The answer is in fact a few other firewall features do use this dll. Namely, it seems, the ability Commodo has of protecting against certain malware firewall-circumvent stratagems. Again, something I don’t really need since I do have an anti-virus. Fortunately, this can be undone. Probably looking in Commodo configuration. But I didn’t have the patience, so:

1. I fully uninstalled Commodo
2. Reboot
3. Install Commodo back again
3.1. Do not install the anti-virus component
3.2 Do no install any firewall features (i.e. choose simple enterprise-strength firewall option when asked)

Hope this helps.
Lazarus is now running as it should.


Logged


Thanks the help!

I really used Comodo Firewall, and this conflict with Lazarus (gdb).
I changed Comodo Firewall to PCTools Firewall, and now running perfectly the Lazarus!

 ;)


Logged


Too I use comodo firewall. I have added lazarus.exe and gdb.exe into My Own Safe Files list, have rebooted also all have earned. (comodo ver 3.9)

Sorry, for my English…


Logged


I have the same error:

Project raised exception class: ‘External: SIGSEGV’

But it appears after my program is started. Program works perfectly until it comes to command:

Image1.Picture.Graphic.Width:=Image1.Width;
Image1.Picture.Graphic.Height:=Image1.Height;

THEN program shows this error. Can somebody help?


Logged


I have the same problem but when using a Delphi app as the host and debugging a dll which appears to complete execution correctly…

Is there another debugger to use in place of this one?!


Logged


I teach students to work in Lazarus, because our university doesn’t provide us a license for Delphi. In the classroom they generated the same bug on their machines (win XP 32 bits SP3) for 3 different progs. We used Lazarus 0.9.28.1. However for older version 0.9.24.0 there was no such a bug (but were others, so we migrated).

But at other computers all works perfectly. I suspect this bug to be in some sense due to limited user right (in other places, where bug doesn’t reveal itself, all people work under administrative rights), but this is only my imho.

This bug appears in the same line allways — never mind what is there written.

We have Kaspersky antivirus active / no firewall.


Logged


I have full administrative rights. Teach your students either .net or java.

The error I had was purely the debugger. Run without debug and it works perfectly… Then again how am I supposed to debug my code without a debugged?? Delphi 2009…


Logged


Maybe there is an unreliable interplay between lazarus and the debugger. If you are lucky you won’t have an issue. If you have issues with the debugger and SIGSEGV it might just be annoying in that it generates an initial error that if dismissed by clicking and closing windows and running again (F9) it will probably work as a debugger. The issue is can you really be sure the debugger is fully functioning after you work around the first SIGSEGV ? Is the next error reported by the debugger real or is it also to be worked around? It is particularly troubling when lazarus runs fine outside the debugger maybe its just luck and failure just hasn’t had a chance to find a situation in which to occur . It maybe that this is a fundamental lazarus debugger incompatibility issue that takes some other variable like the system configuration or some other program running to expose it. Now some can write such good code that they are sure if the debugger reports an error that the debugger must be buggy. Others actually need an iron clad bug free debugger to help them.


Logged


    Проверил новую версию программы под Windows — все работает нормально. Сразу делаю релизный билд под Linux, запускаю и получаю ошибку «Project XYZ raised exception class Segmentation fault (11)». Как это? Что это?
    Запускаю программу под отладкой под Linux и нахожу виновника ошибки. Им оказывается метод определения кодировки:

var
  baBuffer: TBytes;
  Encoding: TEncoding;
...
  TEncoding.GetBufferEncoding(baBuffer, Encoding);

    Паника… Паника… Рабочий день уже давно закончен… Пятница… А ведь уже собрался выходить домой…
    Паника… Паника… Под Windows же все работало… И черт меня дернул проверить версию под Linux, проверил бы в понедельник… Скорее всего виноваты кривые руки разработчиков Delphi, и метод GetBufferEncoding просто не работает под Linux… Смотрю реализацию GetBufferEncoding — никакой зависимости от операционной системы. Так… Руки разработчиков Delphi реабилитированы…
    Паника… Паника… Все .NET-разработчики уже ушли и я в офисе один, как дурак со своим Delphi и Linux… Запускаю отладку под Linux снова… и сползаю со стула — в переменной Encoding уже есть какой-то адрес. Кто ты? А в ответ тишина — мусор по данному адресу разговаривать со мной отказывается. Метод GetBufferEncoding не только возвращает результат в переменную Encoding, но и использует ее для определения кодировки, если она имеет значение отличное от nil. Под Windows компилятор инициализировал переменную Encoding пустым указателем сам, а под Linux оказывается это нужно было сделать программисту.
    В том, что я не инициализировал переменную Encoding пустым указателем я, конечно, не виноват. Логично, что виноват компилятор Delphi под Linux — никакой заботы об удобстве программиста!

    Баг исправлен. Виновные назначены. Можно спокойно идти домой.

>
…raised exception class EConvertError…

  • Подписаться на тему
  • Сообщить другу
  • Скачать/распечатать тему



Сообщ.
#1

,
07.12.08, 10:29

    Здравствуйте.
    Нужно было написать прогу с заданием «В матрице NxM упорядочить строки по возрастанию их первых элементов». Прога, естественно не работает. Вылетает ошибка «Project Project1.exe raised exception class EConverError with message »’is not a valid floating point value’. Process stopped. Use Step or Run to continue.»

    Текст Unit1.bpr:

    ExpandedWrap disabled

      //—————————————————————————

      #include <vcl.h>

      #pragma hdrstop

      #include «Unit1.h»

      int n=3,m=3;

      double **a,**b;

      //—————————————————————————

      #pragma package(smart_init)

      #pragma resource «*.dfm»

      TForm1 *Form1;

      //—————————————————————————

      __fastcall TForm1::TForm1(TComponent* Owner)

              : TForm(Owner)

      {

      }

      //—————————————————————————

      void __fastcall TForm1::FormCreate(TObject *Sender)

      {

      Edit1->Text=IntToStr(n);

      Edit2->Text=IntToStr(m);

      StringGrid1->ColCount=m+1;

      StringGrid1->RowCount=n+1;

      StringGrid2->ColCount=m+1;

      StringGrid2->RowCount=n+1;

      for (int i=1;i<=n;i++){

              StringGrid1->Cells[0][i]=»i=»+IntToStr(i);

              StringGrid2->Cells[0][i]=»i=»+IntToStr(i);

              }

      for (int i=1;i<=m;i++){

              StringGrid1->Cells[i][0]=»j=»+IntToStr(i);

              StringGrid2->Cells[i][0]=»j=»+IntToStr(i);

              }        

      }

      //—————————————————————————

      void __fastcall TForm1::Edit1Change(TObject *Sender)

      {

      n=StrToInt(Edit1->Text);

      StringGrid1->RowCount=n+1;

      StringGrid2->RowCount=n+1;

      for (int i=1;i<=n;i++){

              StringGrid1->Cells[0][i]=»i=»+IntToStr(i);

              StringGrid2->Cells[0][i]=»i=»+IntToStr(i);

              }        

      }

      //—————————————————————————

      void __fastcall TForm1::Edit2Change(TObject *Sender)

      {

      m=StrToInt(Edit2->Text);

      StringGrid1->ColCount=m+1;

      StringGrid2->ColCount=m+1;

      for (int i=1;i<=m;i++){

              StringGrid1->Cells[i][0]=»j=»+IntToStr(i);

              StringGrid2->Cells[i][0]=»j=»+IntToStr(i);

              }

      }

      //—————————————————————————

      void __fastcall TForm1::Button1Click(TObject *Sender)

      {

      int i,c,j,k,x;

      a=new double*[n];

      b=new double*[n];

      for (i=0;i<n;i++){

              a[i]=new double[m];

              b[i]=new double[m];

              }

      for(i=0;i<n;i++){

              for(j=0;j<m;j++)

                      a[i][j]=StrToFloat(StringGrid1->Cells[j+1][i+1]);

              }

      c=1;

      for(j=1;j<n;j++){

      for (i=1;i<n;i++){

              if (a[i][1]>a[i+1][1])

                      x=i+1;

              }

      for (k=1;k<=m;k++){

              b[c][k]=a[x][k];

              a[x][k]=a[n][k];

              }

      n=n-1;

      c=c+1;

      }

      for(i=0;i<n;i++){

              for(j=0;j<n;j++)

                      StringGrid2->Cells[j+1][i+1]=FloatToStrF(b[i][j],ffFixed,8,2);

      }

      }

      //—————————————————————————

      void __fastcall TForm1::Button2Click(TObject *Sender)

      {

      for(int i=0;i<n;i++){

              delete []a[i];

              delete []b[i];

              }

      delete []a;

      delete []b;

      ShowMessage(«Memory is free!»);

      Close();        

      }

      //—————————————————————————

    Текст Project1.bpr

    ExpandedWrap disabled

      //—————————————————————————

      #include <vcl.h>

      #pragma hdrstop

      //—————————————————————————

      USEFORM(«Unit1.cpp», Form1);

      //—————————————————————————

      WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)

      {

              try

              {

                       Application->Initialize();

                       Application->CreateForm(__classid(TForm1), &Form1);

                       Application->Run();

              }                                                            //<<<F8 ПОКАЗЫВАЕТ ОШИБКУ В ЭТОЙ СТРОКЕ

              catch (Exception &exception)

              {

                       Application->ShowException(&exception);

              }

              catch (…)

              {

                       try

                       {

                               throw Exception(«»);

                       }

                       catch (Exception &exception)

                       {

                               Application->ShowException(&exception);

                       }

              }

              return 0;

      }

      //—————————————————————————


    maxim84_



    Сообщ.
    #2

    ,
    07.12.08, 10:40

      это не в этот раздел.

      ExpandedWrap disabled

        a[i][j]=StrToFloat(StringGrid1->Cells[j+1][i+1]);

      тут выход за пределы масива. ;)


      bobjones



      Сообщ.
      #3

      ,
      07.12.08, 12:15

        Цитата

        »is not a valid floating point value’.

        где-то точка вместо запятой. или наоборот.
        иcпользуй TryStrToFloat и иже с ними.


        wtf



        Сообщ.
        #4

        ,
        07.12.08, 14:01

          maxim84_
          Там нет выхода за пределы массива. FixedCols и FixedRows равны 1.
          bobjones
          В исходнике нет никаких дробных чисел.


          bobjones



          Сообщ.
          #5

          ,
          07.12.08, 15:48

            Цитата wtf @ 07.12.08, 14:01

            В исходнике нет никаких дробных чисел.

            уверен? а это откуда?:

            Цитата wtf @ 07.12.08, 10:29

            »’is not a valid floating point value’.

            Добавлено 07.12.08, 15:49

            Сообщение отредактировано: bobjones — 07.12.08, 15:50


            wtf



            Сообщ.
            #6

            ,
            07.12.08, 15:55

              bobjones
              Уверен, можешь просмотреть исходник — ни одного числа с точкой (или запятой). Поэтому и не понимаю к чему тут эта ошибка.


              leo



              Сообщ.
              #7

              ,
              09.12.08, 12:23

                Цитата wtf @ 07.12.08, 15:55

                Уверен, можешь просмотреть исходник — ни одного числа с точкой (или запятой). Поэтому и не понимаю к чему тут эта ошибка

                Судя по исходнику у тебя вобще нет заполнения ячеек с индексами Row,Col > 0, поэтому на a[i],[j]=StrToFloat(..) возникает ошибка, т.к. ячейки — пустые


                shadoff



                Сообщ.
                #8

                ,
                14.03.10, 16:26

                  у меня та же проблема… Немогу понять изза чего

                  ExpandedWrap disabled

                    //—————————————————————————

                    #include <vcl.h>

                    #include <stdlib.h>

                    #pragma hdrstop

                    #include «Unit1.h»

                    //—————————————————————————

                    #pragma package(smart_init)

                    #pragma resource «*.dfm»

                    TForm1 *Form1;

                    int n,i,j;

                    //—————————————————————————

                    __fastcall TForm1::TForm1(TComponent* Owner)

                            : TForm(Owner)

                    {

                    StringGrid2->Cells[0][0]=»  X» ;

                    StringGrid2->Cells[0][1]=»  P» ;

                    }

                    //—————————————————————————

                    void __fastcall TForm1::Button1Click(TObject *Sender)

                    {

                    n=StrToInt(Edit1->Text);

                    StringGrid1->RowCount=n;

                    StringGrid1->ColCount=n;

                     }

                    //—————————————————————————

                    void __fastcall TForm1::Button2Click(TObject *Sender)

                    {

                    //——————VVID tabl————

                    j=j++;

                    if (j==n)

                    {

                    j=0;

                    i=i++;

                    }

                    if ((i+1)==n && (j+1)==n)

                    Button2->Enabled=false;

                    StringGrid1->Cells[i][j]=Edit2->Text;

                    Label1->Caption=i+1;

                    Label2->Caption=j+1;

                    }

                    //—————————————————————————

                    void __fastcall TForm1::Button3Click(TObject *Sender)

                    {

                    float opa, next;

                    for (int i=1; i<=n; i++)

                           { StringGrid2->Cells[i][0]=StringGrid1->Cells[i][0];

                             }

                    for (int i=1; i<=n; i++)

                            {

                           float newstr=StrToFloat(StringGrid1->Cells[i][1]);

                            for (int j=2; j=n; j++)

                            next=StrToFloat(StringGrid1->Cells[1][j]);

                            newstr=newstr + next;

                            if (j==n)

                            StringGrid2->Cells[i][1]=FloatToStr(next);

                                                     }

                            }

                  Проблема именно в конечной части кода
                  Почемуто не хочет присваивать значение етой переменной

                  ExpandedWrap disabled

                    float newstr=StrToFloat(StringGrid1->Cells[i][1])

                  А если де прописать

                  ExpandedWrap disabled

                    float newstr=StrToFloat(StringGrid1->Cells[1][1])

                  То присваивает…
                  Незнаю што делать, помогите


                  Adil



                  Сообщ.
                  #9

                  ,
                  14.03.10, 19:43

                    Ну так отладчик в руки и смотреть, на каком именно i вылетает.


                    leo



                    Сообщ.
                    #10

                    ,
                    15.03.10, 06:27

                      Цитата shadoff @ 14.03.10, 16:26

                      у меня та же проблема… Немогу понять изза чего

                      Действительно та же проблема — невнимательность ;)
                      Во-первых, Cells[i][j] нумеруются от 0, поэтому если у тебя число строк и столбцов = n, то максимально допустимый индекс = n-1, а у тебя циклы в Button3Click, крутятся до n включительно
                      Во-вторых, нет гарантии, что ты не нажмешь кнопку Button3 до того как зполнишь всю матрицу по кнопке Button2 -> тоже выскочит ошибка. Пэтому перед тем как вызывать floattostr не мешало бы делать проверку, что эта строка не пустая

                      Сообщение отредактировано: leo — 15.03.10, 06:28


                      Slefer



                      Сообщ.
                      #11

                      ,
                      06.05.11, 15:58

                        Выпадает такая же ошибка при нажатии button41… Мозг уже взорван…

                        Добавлено 06.05.11, 16:00
                        Сами файлы..

                        0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)

                        0 пользователей:

                        • Предыдущая тема
                        • Borland C++ Builder/Turbo C++ Explorer
                        • Следующая тема

                        [ Script execution time: 0,0640 ]   [ 16 queries used ]   [ Generated: 24.06.23, 20:01 GMT ]  

                      • Ошибка rage multiplayer error game injection has timed out
                      • Ошибка r28 на котле
                      • Ошибка rage mp игровые данные повреждены
                      • Ошибка r27 на котле
                      • Ошибка rage mp gta 5 installation patch