Jump to content
СофтФорум - всё о компьютерах и не только

Помогите...


Recommended Posts

Не так давно, мне помогли с этой прогой(Спасибо Сергею Плоткину), но возникла проблема с созданием блок схемы, помогите.


unit Unit1;

interface

uses

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

Dialogs, StdCtrls;

type

TForm1 = class(TForm)

Memo1: TMemo;

Memo2: TMemo;

Button1: TButton;

procedure Button1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

Chars : set of char;

Nums : set of char;

P1,P2:Integer;

I,I2:Integer;

NewStr,Str:String;

Dobav:Boolean;

CharPart:String;

ContinueCount:Integer;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);

begin

Chars:=[

'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p',

'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'z',

'x', 'c', 'v', 'b', 'n', 'm', 'Q', 'W', 'E', 'R',

'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F',

'G', 'H', 'J', 'K', 'L', 'Z', 'X', 'C', 'V', 'B',

'N', 'M', 'й', 'ц', 'у', 'к', 'е', 'н', 'г', 'ш',

'щ', 'з', 'х', 'ъ', 'ф', 'ы', 'в', 'а', 'п', 'р',

'о', 'л', 'д', 'ж', 'э', 'я', 'ч', 'с', 'м', 'и',

'т', 'ь', 'б', 'ю', 'Й', 'Ц', 'У', 'К', 'Е', 'Н',

'Г', 'Ш', 'Щ', 'З', 'Х', 'Ъ', 'Ф', 'Ы', 'В', 'А',

'П', 'Р', 'О', 'Л', 'Д', 'Ж', 'Э', 'Я', 'Ч', 'С',

'М', 'И', 'Т', 'Ь', 'Б', 'Ю'

];

Nums := ['0','1','2','3','4','5','6','7','8','9'];

ContinueCount:=0;

NewStr:='';

Str:=Memo1.Text;

For I := 1 to Length(Str) do

begin

If ContinueCount>0 then

begin

ContinueCount:=ContinueCount-1;

Continue;

end;

Dobav:=True;

If (Str in Chars) and (I+3<=Length(Str)) and (Str[i+1]='(') then

begin

P1:=0;

P2:=0;

For I2 := I+2 to Length(Str) do

begin

If I2>I+5 then Break;

if (Str[i2] in Nums) AND (P1=0) then

begin

P1:=I2;

end else if Str[i2]=')' then

begin

if I2=I+2 then

Break else

begin

P2:=I2;

Break;

end;

end;

end;

If (P1>0) and (P2>0) then

begin

CharPart:='';

For I2 := 1 to StrToInt(Copy(Str, P1, P2-P1)) do

CharPart:=CharPart+Str;

Dobav:=False;

NewStr:=NewStr+CharPart;

ContinueCount:=(P2-P1)+2;

end;

If Dobav=True then

NewStr:=NewStr+Str;

end else

begin

NewStr:=NewStr+Str;

end;

end;

Memo2.Lines.Text:=NewStr;

end;

end.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...