음냐..한글을 하나하나씩 잘라서 비교를 할라구
Length함수와 Copy함수..Asicomparestr함수를 써가지구..
unit hanunjung4;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, Buttons;
type
TForm4 = class(TForm)
Image1: TImage;
Edit1: TEdit;
Edit2: TEdit;
Timer1: TTimer;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
rannum:integer;
chongnum1:integer;
chongnum2:integer;
bikyo1:array[1..10] of string;
bikyo2:array[1..10] of string;
implementation
function qqq(str1:string;str2:string):integer;
var
a:integer;
begin
a:=Ansicomparestr(str1,str2);
qqq:=a;
end;
{$R *.DFM}
const
abcabc:array[1..165] of string= { 예제문 }
('PROGRAM' ,'BEGIN' ,'REPEAT' ,'UNTIL' ,'IF' , { 01 }
'THEN' ,'ELSE' ,'FOR' ,'TO' ,'DO' , { 02 }
'UNIT' ,'INTERFACE' ,'PROCEDURE' ,'END;' ,'END.' , { 03 }
'SOUND' ,'NOSOUND' ,'DELAY' ,'GRAPH' ,'INITGRAPH' , { 04 }
'FLOODFILL' ,'LINE' ,'RECTANGLE' ,'BAR' ,'CIRCLE' , { 05 }
'SIN' ,'COS' ,'PUTPIX' ,'OUTTEXT' ,'OUTTEXTXY' , { 06 }
'SETCOLOR' ,'GETIMAGE' ,'PUTIMAGE' ,'GETMEM' ,'FREEMEM' , { 07 }
'POINTER' ,'SIZE' ,'IMAGESIZE' ,'ASSIGN' ,'RESET' , { 08 }
'REWRITE' ,'CLOSE' ,'APPEND' ,'READ' ,'READLN' , { 09 }
'WRITE' ,'WRITELN' ,'EOF' ,'SEEKEOLN' ,'RESET' , { 10 }
'BLOCKREAD' ,'BLOCKWRITE','FILEPOS' ,'FILESIZE' ,'SEEK' , { 11 }
'TRUNCATE' ,'GETDATA' ,'SETDATE' ,'GETTIME' ,'PUTTIME' , { 12 }
'DISKFREE' ,'DISKSIZE' ,'DOSVERSION','PRINTER' ,'DOS' , { 13 }
'LST' ,'TURBO' ,'PASCAL' ,'DIV' ,'MOD' , { 14 }
'SQR' ,'VAR' ,'READ' ,'INTEGER' ,'CHAR' , { 15 }
'STRING' ,'LONGINT' ,'BYTE' ,'WORD' ,';' , { 16 }
'CONST' ,'LABEL' ,'FUNCTION' ,'CASE' ,'ELSE' , { 17 }
'ORD' ,'CHR' ,'CRT' ,'PRED' ,'SUCC' , { 18 }
'UPCASE' ,'CONCAT' ,'COPY' ,'DELETE' ,'INSERT' , { 19 }
'LENGTH' ,'POS' ,'STR' ,'VAL' ,'ABS' , { 20 }
'TRUNC' ,'ROUND' ,'INT' ,'SIN' ,'COS' , { 21 }
'ARCTAN' ,'LN' ,'SQRT' ,'EXP' ,'FRAC' , { 22 }
'RANDOM' ,'TEXTCOLOR' ,'ARRAY' ,'OF' ,'KEYPRESSED', { 23 }
'READ' ,'WRITELN' ,'WRITE' ,'KEYPRESSED','DISKETTES' , { 24 }
'FORMAT' ,'DISKCOPY' ,'NCD' ,'COPY' ,'DEL' , { 25 }
'MOVE' ,'VER' ,'TIME' ,'DATE' ,'INSTALL' , { 26 }
'PARK' ,'POWER' ,'HARD' ,'FULLOPY' ,'DISK' , { 27 }
'DRAIVE' ,'FILE' ,'NOT' ,'COMMAND' ,'LOCK' , { 28 }
'RESET' ,'MD' ,'CHDIR' ,'CD' ,'XCOPY' , { 29 }
'MDIR' ,'PATH' ,'CONFIG' ,'DOSSHELL' ,'SYS' , { 30 }
'SYSTEM' ,'FDISK' ,'SETUP' ,'BAD' ,'SECTOR' , { 31 }
'NAME' ,'OR' ,'DIRECTORY' ,'MOUSE' ,'QMOUSE' , { 32 }
'YMOUSE' ,'DP' ,'GLOW' ,'I' ,'IMPLAY' ); { 33 }
abcnum=165;
procedure TForm4.BitBtn2Click(Sender: TObject);
begin
close;
end;
procedure TForm4.BitBtn1Click(Sender: TObject);
var
a,b,c,e,k,m,numcounte:integer;
f:real;
begin
repeat
rannum:=random(abcnum)+1;
edit1.text:=abcabc[rannum];
chongnum1:=Length(Edit1.text);
for k:=1 to chongnum1 do
bikyo1[k]:=Copy(Edit1.text,k,1);
chongnum2:=Length( edit2.text);
for m:=1 to chongnum2 do
bikyo2[m]:=Copy( edit2.text,m,1);
e:=0;
numcounte:=0;
for a:=1 to chongnum1 do
begin
b:=qqq(bikyo1[a],bikyo2[a]);
if b=0 then
c:=1
else
c:=0;
e:=e+c;
numcounte:=numcounte+1;
end;
label5.Caption:='0';
if chongnum1>=1 then
begin
if chongnum1=numcounte then
begin
f:= chongnum1*100/ e;
label5.Caption:=floattostr(f);
end;
end;
until false;
end;
end.
요러케 만들어 꺼덩여..군뎅...실행을 하묜..일단은 떠요..
군뎅..실행 버튼을 느르면...에러가 나민스...ㅠ.ㅠ
수정이나 조언좀 부탁 합니당..