Q&A

  • 수많은 에러 어떻게 해요 T.T
unit Unit1;



interface



uses

Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

StdCtrls;



type

Tfrminput = class(TForm)

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

Label4: TLabel;

Label5: TLabel;

Button1: TButton;

Button2: TButton;

edit1: TEdit;

Edit2: TEdit;

Edit3: TEdit;

Edit4: TEdit;

Edit5: TEdit;

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure FormCreate(Sender: TObject);



private

{ Private declarations }

public

{ Public declarations }

end;



{입력 자료 형식 정의}

type Tinput=record

dep_code:string;//부서코드

in_num :string; //시내통화량

out1_num : string;//시외 1대역 통화량

out2_num: string; //시외 2대역 통화량

method:string//결재코드

end;



{출력 자료 형식 정의}

type Toutput=record

dep_name:string;//부서명

call_num:string;//전화번호

in_value:integer;//시내통화금액

out_value:integer;//시외통화금액

tax:integer;//세금

total_value:integer;//통화총액

etc:string //비고

end;





var

frminput: Tfrminput;



{프로그램 전역변수선언}





count:integer;

in_data:array[1..7] of tinput ; //입력자료배열선언

out_data:array[1..7] of toutput; //출력자료 배열선언





implementation



uses unit2;

{$R *.DFM}



{입력버튼이 눌렸을 경우 실행되는 함수}

procedure Tfrminput.Button1Click(Sender: TObject);



var

i,discount,ou1,out2,call_value:integer;//루프용변수

disrate:real;







begin

{최대 입력건수는 7건이하로 간주한다.}

if count>7 then

showmessage('최대입력건수를 초과하였습니다.');

exit;

end;





if count >= 2 then

for i:=1 to count-1 do

if uppercase(in_data[i].dep_code) = uppercase(edit1.text) then

begin

showmessage('부서코드가 중복되었습니다.');

edit1.text:='';

edit1.setfocus;

exit;

end;





with Out_data[count] do

begin

{부서명과 전화번호를 구한다.}

if uppercase(edit1.text)='A' then

begin

dep_name:='총무부';

call_num:='940-8857';

end

else if uppercase(edit1.text)='B' then

begin

dep_name:='인사부';

call_num:='940-6589';

end

else if uppercase(edit1.text)='C' then

begin

dep_name:='영업1부';

call_num:='940-7740';

end

else if uppercase(edit1.text) ='D' then

begin

dep_name:='영업2부';

call_num:='940-5212';

end

else if uppercase(edit1.text) ='E' then

begin

dep_name:='영업3부';

call_num:='940-6320';

end

else

begin

showmessage('부서코드 입력 오류입니다.!');

edit1.text:='';

edit1.setfocus;

exit;

end;



{시내통화량을 입력한다. 단,3자리 이하의 정수로 입력}

if (edit2.text<>'') and (edit2.text>0) and (edit2.text<=999) then

begin

in_value := 50*edit2.text;

end

else

begin

showmessage('시내 통화량 입력오류!!');

edit2.text:='';

edit2.setfocus;

exit;

end;



{시외1대역 통화량과 시외 2대역 통화량을 3자리 이하의 정수로 입력}





if (edit3.text<>'') and (edit3.text>0) and (edit3.text<=999) then

begin

out1 := edit3.text;

end

else

begin

showmessage('시외 1대역 통화량 입력오류!!');

edit3.text:='';

edit3.setfocus;

exit;

end;



if (edit4.text<>'') and (edit4.text>0) and (edit4.text<=999) then

begin

out2 := edit4.text;

end

else

begin

showmessage('시외 1대역 통화량 입력오류!!');

edit4.text:='';

edit4.setfocus;

exit;

end;



out_value:= (out1*80)+(out2*120);









{결재코드표에 따른 할인률입력}

if uppercase(edit5.text)='PA' then

begin

disrate := 0;

end

else if uppercase(edit5.text)='PB' then

begin

disrate := 0.02;

end

else if uppercase(eidt5.text)='PC' then

begin

disrate := 0.05;

end;





call_value:=in_value+out_value+3000;

tax:=call_value*0.1;

discount:=call_value+tax*disrate;

total_value:=(call_value+tax+3000)-discount;



if (total_value<=30000) then

begin

etc:='절약';

end

else

begin

etc:='';

exit;

end;



{입력배열에 자료 저장}

with in_data[count] do

begin

dep_code :=edit1.text;

in_num :=edit2.text;

out1_num :=edit3.text;

out2_num :=edit4.text;

method :=edit5.text;

end;



{입력을 초기화}

edit1.text:='';

edit2.text:='';

edit3.text:='';

edit4.text:='';

edit5.text:='';



edit1.setfocus;

inc(count);

end;



{출력버튼이 눌렸을때 처리되는 함수}

procedure Tfrminput.Button2Click(Sender: TObject);

var

temp:toutput;

i,j:integer;



begin

dec(count);

if count<1 then

begin

showmessage('입력된자료가 없습니다.');

edit1.setfocus;

exit;

end;



for i:=1 to count-1 do

for j:=i+1 to count do

if out_data[i].total_value>out_data[j].total_value then

begin

temp:=out_data[i];

out_data[i]:=out_data[j];

out_data[j]:=temp;

end;



frminput.hide;

frmoutput.show;





end;







procedure Tfrminput.FormCreate(Sender: TObject);

begin

count:=1;//폼이 열렸을 때 count값 1로 초기화

end;



end.









[Hint] Unit1.pas(74): Variable 'i' is declared but never used in 'Tfrminput.Button1Click'

[Hint] Unit1.pas(74): Variable 'discount' is declared but never used in 'Tfrminput.Button1Click'

[Hint] Unit1.pas(74): Variable 'ou1' is declared but never used in 'Tfrminput.Button1Click'

[Hint] Unit1.pas(74): Variable 'out2' is declared but never used in 'Tfrminput.Button1Click'

[Hint] Unit1.pas(74): Variable 'call_value' is declared but never used in 'Tfrminput.Button1Click'

[Hint] Unit1.pas(75): Variable 'disrate' is declared but never used in 'Tfrminput.Button1Click'

[Error] Unit1.pas(94): Declaration expected but 'IF' found

[Error] Unit1.pas(99): Undeclared identifier: 'edit1'

[Error] Unit1.pas(99): Missing operator or semicolon

[Error] Unit1.pas(100): Missing operator or semicolon

[Error] Unit1.pas(102): '.' expected but ';' found

[Error] Unit1.pas(106): Identifier redeclared: 'Finalization'

[Error] Unit1.pas(108): ')' expected but identifier 'text' found

[Error] Unit1.pas(110): Undeclared identifier: 'dep_name'

[Error] Unit1.pas(111): Undeclared identifier: 'call_num'

[Error] Unit1.pas(113): ')' expected but identifier 'text' found

[Error] Unit1.pas(118): ')' expected but identifier 'text' found

[Error] Unit1.pas(123): ')' expected but identifier 'text' found

[Error] Unit1.pas(128): ')' expected but identifier 'text' found

[Error] Unit1.pas(136): Missing operator or semicolon

[Error] Unit1.pas(137): Missing operator or semicolon

[Error] Unit1.pas(142): Undeclared identifier: 'edit2'

[Error] Unit1.pas(144): Undeclared identifier: 'in_value'

[Error] Unit1.pas(144): Missing operator or semicolon

[Error] Unit1.pas(145): Statement expected, but expression of type 'Text' found

[Error] Unit1.pas(149): Missing operator or semicolon

[Error] Unit1.pas(150): Missing operator or semicolon

[Error] Unit1.pas(157): Undeclared identifier: 'edit3'

[Error] Unit1.pas(159): Undeclared identifier: 'out1'

[Error] Unit1.pas(159): Missing operator or semicolon

[Error] Unit1.pas(160): Statement expected, but expression of type 'Text' found

[Error] Unit1.pas(164): Missing operator or semicolon

[Error] Unit1.pas(165): Missing operator or semicolon

[Error] Unit1.pas(169): Undeclared identifier: 'edit4'

[Error] Unit1.pas(171): Undeclared identifier: 'out2'

[Error] Unit1.pas(171): Missing operator or semicolon

[Error] Unit1.pas(172): Statement expected, but expression of type 'Text' found

[Error] Unit1.pas(176): Missing operator or semicolon

[Error] Unit1.pas(177): Missing operator or semicolon

[Error] Unit1.pas(181): Undeclared identifier: 'out_value'

[Error] Unit1.pas(187): Undeclared identifier: 'edit5'

[Error] Unit1.pas(189): Undeclared identifier: 'disrate'

[Error] Unit1.pas(191): ')' expected but identifier 'text' found

[Error] Unit1.pas(195): Undeclared identifier: 'eidt5'

[Error] Unit1.pas(201): Undeclared identifier: 'call_value'

[Error] Unit1.pas(202): Undeclared identifier: 'tax'

[Error] Unit1.pas(203): Undeclared identifier: 'discount'

[Error] Unit1.pas(204): Undeclared identifier: 'total_value'

[Error] Unit1.pas(208): Undeclared identifier: 'etc'

[Error] Unit1.pas(219): Missing operator or semicolon

[Error] Unit1.pas(220): Missing operator or semicolon

[Error] Unit1.pas(220): Missing operator or semicolon

[Error] Unit1.pas(221): Missing operator or semicolon

[Error] Unit1.pas(221): Missing operator or semicolon

[Error] Unit1.pas(222): Missing operator or semicolon

[Error] Unit1.pas(222): Missing operator or semicolon





전 왕초보입니다.(델파이 시작 4일째..)

분명히 다 정의를 해주었는데 이런 에러가 납니다...



도와주세요.... 부탁드려요...

제가 델파이로 정보처리기사 시험을 보려는데 너무 어렵습니다...



도와주세요..도와주세요...

T.T;;

1  COMMENTS
  • Profile
    Mr.Q 2000.07.23 08:26
    -.-;

    거의 모든 에러가, 스트링변수를 숫자형변수로 변환해주지 않아서 생긴것이고

    나머지는 오타입니다.

    if (edit1.text>3)

    여기서 edit1.text는 string형이고, 3은 숫자입니다.

    이것을 비교하려면, StrToInt를 사용해서 형변환을 해줘야합니다.

    stttoint(edit1.text)>3



    ----------------------------------------------------------------------------

    unit Unit1;



    interface



    uses

    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

    StdCtrls;



    type

    TfrmInput = class(TForm)

    Label1: TLabel;

    Label2: TLabel;

    Label3: TLabel;

    Label4: TLabel;

    Label5: TLabel;

    Edit1: TEdit;

    Edit2: TEdit;

    Edit3: TEdit;

    Edit4: TEdit;

    Edit5: TEdit;

    Button1: TButton;

    Button2: TButton;

    procedure Button1Click(Sender: TObject);

    procedure Button2Click(Sender: TObject);

    private

    { Private declarations }

    public

    { Public declarations }

    end;



    var

    frmInput: TfrmInput;

    count:integer;



    implementation



    {$R *.DFM}



    type Tinput=record

    dep_code:string;//부서코드

    in_num :string; //시내통화량

    out1_num : string;//시외 1대역 통화량

    out2_num: string; //시외 2대역 통화량

    method:string//결재코드

    end;



    {출력 자료 형식 정의}

    type Toutput=record

    dep_name:string;//부서명

    call_num:string;//전화번호

    in_value:integer;//시내통화금액

    out_value:integer;//시외통화금액

    tax:integer;//세금

    total_value:integer;//통화총액

    etc:string //비고

    end;



    var

    in_data:array[1..7] of tinput ; //입력자료배열선언

    out_data:array[1..7] of toutput; //출력자료 배열선언





    procedure TfrmInput.Button1Click(Sender: TObject);

    var

    i,discount,out1,out2,call_value:integer;//루프용변수

    disrate:real;

    begin

    {최대 입력건수는 7건이하로 간주한다.}

    if count>7 then begin

    showmessage('최대입력건수를 초과하였습니다.');

    exit;

    end;





    if count >= 2 then

    for i:=1 to count-1 do

    if uppercase(in_data[i].dep_code) = uppercase(edit1.text) then

    begin

    showmessage('부서코드가 중복되었습니다.');

    edit1.text:='';

    edit1.setfocus;

    exit;

    end;





    with Out_data[count] do

    begin

    {부서명과 전화번호를 구한다.}

    if uppercase(edit1.text)='A' then

    begin

    dep_name:='총무부';

    call_num:='940-8857';

    end

    else if uppercase(edit1.text)='B' then

    begin

    dep_name:='인사부';

    call_num:='940-6589';

    end

    else if uppercase(edit1.text)='C' then

    begin

    dep_name:='영업1부';

    call_num:='940-7740';

    end

    else if uppercase(edit1.text) ='D' then

    begin

    dep_name:='영업2부';

    call_num:='940-5212';

    end

    else if uppercase(edit1.text) ='E' then

    begin

    dep_name:='영업3부';

    call_num:='940-6320';

    end

    else

    begin

    showmessage('부서코드 입력 오류입니다.!');

    edit1.text:='';

    edit1.setfocus;

    exit;

    end;



    {시내통화량을 입력한다. 단,3자리 이하의 정수로 입력}

    if (edit2.text<>'') and (strtoint(edit2.text)>0) and (strtoint(edit2.text)<=999) then

    begin

    in_value := 50*strtoint(edit2.text);

    end

    else

    begin

    showmessage('시내 통화량 입력오류!!');

    edit2.text:='';

    edit2.setfocus;

    exit;

    end;



    {시외1대역 통화량과 시외 2대역 통화량을 3자리 이하의 정수로 입력}





    if (edit3.text<>'') and (strtoint(edit3.text)>0) and (strtoint(edit3.text)<=999) then

    begin

    out1 := strtoint(edit3.text);

    end

    else

    begin

    showmessage('시외 1대역 통화량 입력오류!!');

    edit3.text:='';

    edit3.setfocus;

    exit;

    end;



    if (edit4.text<>'') and (strtoint(edit4.text)>0) and (strtoint(edit4.text)<=999) then

    begin

    out2:= strtoint(edit4.text);

    end

    else

    begin

    showmessage('시외 1대역 통화량 입력오류!!');

    edit4.text:='';

    edit4.setfocus;

    exit;

    end;



    out_value:= (out1*80)+(out2*120);









    {결재코드표에 따른 할인률입력}

    if uppercase(edit5.text)='PA' then

    begin

    disrate := 0;

    end

    else if uppercase(edit5.text)='PB' then

    begin

    disrate := 0.02;

    end

    else if uppercase(edit5.text)='PC' then

    begin

    disrate := 0.05;

    end;





    call_value:=in_value+out_value+3000;

    tax:=round(call_value*0.1);

    discount:=round(call_value+tax*disrate);

    total_value:=(call_value+tax+3000)-discount;



    if (total_value<=30000) then

    begin

    etc:='절약';

    end

    else

    begin

    etc:='';

    exit;

    end;



    {입력배열에 자료 저장}

    with in_data[count] do

    begin

    dep_code :=edit1.text;

    in_num :=edit2.text;

    out1_num :=edit3.text;

    out2_num :=edit4.text;

    method :=edit5.text;

    end;



    {입력을 초기화}

    edit1.text:='';

    edit2.text:='';

    edit3.text:='';

    edit4.text:='';

    edit5.text:='';



    edit1.setfocus;

    inc(count);

    end;



    end;

    procedure TfrmInput.Button2Click(Sender: TObject);

    var

    temp:toutput;

    i,j:integer;

    begin

    dec(count);

    if count<1 then

    begin

    showmessage('입력된자료가 없습니다.');

    edit1.setfocus;

    exit;

    end;



    for i:=1 to count-1 do

    for j:=i+1 to count do

    if out_data[i].total_value>out_data[j].total_value then

    begin

    temp:=out_data[i];

    out_data[i]:=out_data[j];

    out_data[j]:=temp;

    end;



    frminput.hide;

    frmoutput.show;





    end;



    end.



    • 사람
    • 2000.07.24 06:51
    • 0 COMMENTS
    • /
    • 0 LIKES
    • kanis
    • 2000.07.24 06:51
    • 2 COMMENTS
    • /
    • 0 LIKES
    • 최석기
      2000.07.24 20:03
      kanis wrote: > ADO를 사용해서 프로그램을 만들구, 또 설치프로그램도 만들었습니다. > 그런데.... mdac...
    • 나현희
      2000.07.25 02:22
      에구 에구... 담번에 알아 보시네. 그럴줄 알았다면 그냥 바로 물어볼걸... launch application dialog ...
    • 황현
    • 2000.07.24 06:03
    • 0 COMMENTS
    • /
    • 0 LIKES
    • 오광배
      2000.07.29 02:39
      박종삼 wrote: > 서버소켓에 특정 IP 번호를 대입시킬 방법은 없나요.. > > ServerSocket1.Socket.Conn...
    • Mr.Q
      2000.07.24 05:38
      김미좌 wrote: > 알려주시면 감사하겠습니다. 우선 호출하는 폼의 KeyPreview속성을 true로 놓고 KeyDo...
    • 김미좌
      2000.07.24 06:01
      답변감사합니다. 그런데 님의 말씀대로 했는데.... 실행이 되지않습니다 왜그럴까요 호출하는폼은 mdim...
    • Mr.Q
      2000.07.24 07:19
      김미좌 wrote: > 답변감사합니다. > 그런데 님의 말씀대로 했는데.... > 실행이 되지않습니다 > 왜그럴...
    • 김미좌
      2000.07.24 16:30
      답변감사합니다
    • 박상문
    • 2000.07.24 02:34
    • 1 COMMENTS
    • /
    • 0 LIKES
    • 이재식
      2000.07.24 09:29
      박상문 wrote: > > 안녕하세요 > 현재 excel 로 작성된 data를 델파이 에서 끌어 올려고 합니다 > ...
    • 델초보
    • 2000.07.24 02:09
    • 1 COMMENTS
    • /
    • 0 LIKES
    • 정지호
      2000.07.24 19:03
      델초보 wrote: > 최준연님 답변에 감사드립니다. > 그런데 ShellExecute함수 사용하는 방법을 좀더 구체...
    • 최준연
    • 2000.07.24 00:52
    • 1 COMMENTS
    • /
    • 0 LIKES
    • Mr.Q
      2000.07.24 02:31
      최준연 wrote: > Dbnavigator의 취소 버튼기능을 구현해보려합니다. > 문제는 마지막 세번째 procedure의...
    • 델초보
    • 2000.07.23 23:54
    • 1 COMMENTS
    • /
    • 0 LIKES
    • 최준연
      2000.07.24 00:20
      델초보 wrote: > 제가 넘 초보질문을 하나요? T.T > 폼에서 버튼이나 글씨를 클릭하면 익스플로러로 HTML...
    • 최준연
      2000.07.24 00:04
      사발우성 wrote: > 안뇽 하십니꺼 사발임당..^^ > > 올만에 질문임당...한2주.....^^ > > 지가엽.. ...
    • 사발우성
      2000.07.24 00:25
      헐 내용 없다니깐.....--+
    • 샘나라
      2000.07.27 11:50
      정말 감사합니다. (^^)(__) 꾸벅~~ 님들 덕에 연결하는데 성공했네요. 에거~~ 이렇게 간단한걸...
    • ADO광신자-왕자^^;
      2000.07.24 20:30
      안녕하세요..영원한 델초보 어린왕자입니다요.. 델5.0이니깐 ADO컴포넌트 쓰심이 어떠실런지.. TADOTable...
    • 최준연
      2000.07.24 00:00
      샘나라 wrote: > 델파이로 MS-Access DB를 연결해서 DB Grid에 나타내려고 합니다. > Table 컴포넌트와 D...
    • 최준연
      2000.07.23 23:42
      델초보 wrote: > SP -> SPSearch 를 작성하고 결과를 변수에 넣으려 하는데 에러가 나서 질문을 > 올립...
    • 최준연
    • 2000.07.23 23:20
    • 1 COMMENTS
    • /
    • 0 LIKES
    • 오광배
      2000.07.29 03:32
      최준연 wrote: > 정말 기본적인 문제인것 같은데 잘 안되는걸요... > > 버튼 클릭했을때에 데이타가 이...
    • 최준연
    • 2000.07.23 21:48
    • 2 COMMENTS
    • /
    • 0 LIKES
    • Mr.Q
      2000.07.23 23:43
      최준연 wrote: > SetFocus를 단지 커서하나만 두는것이 아니라 텍스트 전체를 블록지정한 형태로 구현 > ...
    • 최준연
      2000.07.24 00:26
      Mr.Q wrote: > 최준연 wrote: > > SetFocus를 단지 커서하나만 두는것이 아니라 텍스트 전체를 블록지정...
    • 최준연
    • 2000.07.23 09:02
    • 3 COMMENTS
    • /
    • 0 LIKES
    • Mr.Q
      2000.07.23 09:29
      최준연 wrote: > 예를들어서, 테이블에 다음과같은 두개의 필드가 있습니다. > > 이름 -- char(20) > ...
    • 최준연
      2000.07.23 09:35
      Mr.Q wrote: > > DBImage컴포를 쓰세요. datasource를 지정하고, > datafield에 이미지가 저장되있는 b...
    • Mr.Q
      2000.07.23 09:49
      최준연 wrote: > Mr.Q wrote: > > > > DBImage컴포를 쓰세요. datasource를 지정하고, > > datafield...
    • 최준연
    • 2000.07.23 09:03
    • 4 COMMENTS
    • /
    • 0 LIKES
    • Mr.Q
      2000.07.23 09:18
      on EInvalidGraphic do 하시면됩니다. 디자인타임시, 예외오류메세지창이 뜰때, 읽어보면 예외명이 나옵...
    • 최준연
      2000.07.23 09:25
      Mr.Q wrote: > on EInvalidGraphic do 하시면됩니다. > 디자인타임시, 예외오류메세지창이 뜰때, 읽어보...
    • Mr.Q
      2000.07.23 09:39
      최준연 wrote: > Mr.Q wrote: > > on EInvalidGraphic do 하시면됩니다. > > 디자인타임시, 예외오류메...
    • 최준연
      2000.07.23 23:26
      비베에서는 예외처리를 하면 Run 시킬때도 그게 적용이 되어서 에러를 제어할수 있는데 델파이에서는 ex...
    • 왕초보
    • 2000.07.23 07:17
    • 1 COMMENTS
    • /
    • 0 LIKES
    • Mr.Q
      2000.07.23 08:26
      -.-; 거의 모든 에러가, 스트링변수를 숫자형변수로 변환해주지 않아서 생긴것이고 나머지는 오타입니다...