H� ����� �� All ���������, ��� ���������� � exception ������� �� ����? ����
����������������� "����������" ������ catching ������� �� ����
�� ����������. � ���� ������ k_razb ������������ ��� INF. H� ��� �����
������ ������ � catch.
class TForm1 : public TForm
{
__published: // IDE-managed Components
TADOConnection *ADOConnection1;
TADOQuery *Qver;
TADOQuery *Q1;
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
��� ������ �����:
=========Beginning of the citation==============
#include <vcl.h>
#pragma hdrstop
#include "zero_del_f.h"
//--------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//--------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
int er=0,kol_lines; Variant x; AnsiString astr;
//��� ������� �� ������ ������ (����� ADO �����������)
try
{
Q1->Active = true;
kol_lines = Q1->RecordCount;
}
catch(Exception& er)
{ /* */ }
//--------------------
//���������� ������ ��� ��������� exception
/* try //���� ������ ������!
{
Qver->Active = true;
x = Qver->FieldValues["Name"];
astr = x; //���������� ������
}
catch(Exception& er)
{ ShowMessage("��� ������ ������"); } */
//--------------------
double Q1c,Q2c,k_razb,rea; unsigned int err=0;
try
{
Q1c = 0.0;
Q2c = 1.0;
k_razb = ((Q1c - Q2c)/Q1c)*100.0;
}
catch (Exception& E)
{ er = 1; }
if(er) { ShowMessage("catching OK"); return; }
ShowMessage("catching failed");
}
//--------------
=========The end of the citation================
Bye All!
Alexander
fido7.ru.cbuilder 2009
���-��, �������, ���� 21 2009, � 11:24, alexander koryagin ������� � All ��
����� ��������, �� ��� ���ң� _"�����, ���� �� ����� ��� ����� ���������? :)"_
ak> From: "alexander koryagin" <kory...@erec.ru>
ak> Hello, All!
ak> H� ����� �� All ���������, ��� ���������� � exception ������� �� ����?
ak> ���� ����������������� "����������" ������ catching ������� �� ���� ��
ak> ����������. � ���� ������ k_razb ������������ ��� INF. H� ���
ak> ����� ������ ������ � catch.
ak> class TForm1 : public TForm
ak> {
ak> __published: // IDE-managed Components
ak> TADOConnection *ADOConnection1;
ak> TADOQuery *Qver;
ak> TADOQuery *Q1;
ak> private: // User declarations
ak> public: // User declarations
ak> __fastcall TForm1(TComponent* Owner);
ak> };
ak> ��� ������ �����:
ak> =========Beginning of the citation==============
ak> #include <vcl.h>
ak> #pragma hdrstop
ak> #include "zero_del_f.h"
ak> //--------------
ak> #pragma package(smart_init)
ak> #pragma resource "*.dfm"
ak> TForm1 *Form1;
ak> //--------------
ak> __fastcall TForm1::TForm1(TComponent* Owner)
ak> : TForm(Owner)
ak> {
ak> int er=0,kol_lines; Variant x; AnsiString astr;
ak> //��� ������� �� ������ ������ (����� ADO �����������)
ak> try
ak> {
ak> Q1->Active = true;
ak> kol_lines = Q1->RecordCount;
ak> }
ak> catch(Exception& er)
ak> { /* */ }
ak> //--------------------
ak> //���������� ������ ��� ��������� exception
ak> /* try //���� ������ ������!
ak> {
ak> Qver->Active = true;
ak> x = Qver->FieldValues["Name"];
ak> astr = x; //���������� ������
ak> }
ak> catch(Exception& er)
ak> { ShowMessage("��� ������ ������"); } */
ak> //--------------------
ak> double Q1c,Q2c,k_razb,rea; unsigned int err=0;
ak> try
ak> {
ak> Q1c = 0.0;
ak> Q2c = 1.0;
ak> k_razb = ((Q1c - Q2c)/Q1c)*100.0;
ak> }
ak> catch (Exception& E)
ak> { er = 1; }
ak> if(er) { ShowMessage("catching OK"); return; }
ak> ShowMessage("catching failed");
ak> }
ak> //--------------
ak> =========The end of the citation================
����� ��� ������� �� 0 ������������ ���������� ����������� � �����������
�������, ��� ������ ���� ������� ���������� ���������� ��� �������������. ��
����� Range Checking, �� �� ������.
����� ��� ����� ����������, alexander.�������.
ak>> H� ����� �� All ���������, ��� ���������� � exception ������� �� ����?
ak>> ���� ����������������� "����������" ������ catching ������� �� ���� ��
ak>> ����������. � ���� ������ k_razb ������������ ��� INF. H� ���
ak>> ����� ������ ������ � catch.
[Skipped]
ak>> try
ak>> {
ak>> Q1c = 0.0;
ak>> Q2c = 1.0;
ak>> k_razb = ((Q1c - Q2c)/Q1c)*100.0;
ak>> }
ak>> catch (Exception& E)
ak>> { er = 1; }
ak>> if(er) { ShowMessage("catching OK"); return; }
ak>> ShowMessage("catching failed");
ak>> }
ak>> //--------------
ak>> =========The end of the citation================
DG> ����� ��� ������� �� 0 ������������ ���������� ����������� �
DG> ����������� �������, ��� ������ ���� ������� ���������� ���������� ���
DG> �������������. �� ����� Range Checking, �� �� ������.
DG> ����� ��� ����� ����������, alexander.�������.
H�, �� �������. ������ �� ����, ��� ��� ����� ����������� ������ � win98.
���� ��� ��� �������� � ���, �� ����� ���������� � ����������� �������� (�
������, ������ � ��������� �����)
http://www.koryagin.newmail.ru/share/test_exp_div0a.zip
������ - ������ ��������� ������ ��������� �������������� ����� exception.
���� ��� ������� �������, �� exception ������� �� ���� �� �������. ;)
[...A rolling stone gathers no moss]
Bye Dmytry!
Alexander
fido7.ru.cbuilder 2009