Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions 20_Task/M1/10_Variable/VariableForm.pas
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
unit VariableForm;

interface

//����� �׽�Ʈ
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
Expand All @@ -16,9 +16,9 @@ TForm1 = class(TForm)
procedure Button1Click(Sender: TObject);
private
// �� ��(����)������ ����ϴ� ������ �Լ��� ����

var
FSum:integer;
{ TODO : (1) ���� �� FSum ������ �����ϼ���. }

function AddNum(ANum: Integer): Integer;
public
// �ٸ� ���ֿ��� ������ �� �ִ� ������ �Լ� ����
Expand All @@ -36,7 +36,8 @@ function TForm1.AddNum(ANum: Integer): Integer;
{ TODO :
(2) FSum ������ �Ķ���� ANum ���� ���մϴ�.
FSum ���� ��ȯ }
Result := 0;
FSum:=FSum+ANum;
Result := FSum;
end;

procedure TForm1.Button1Click(Sender: TObject);
Expand All @@ -45,8 +46,8 @@ procedure TForm1.Button1Click(Sender: TObject);
begin
Num := StrToInt(edtNum.Text);
Sum := AddNum(Num);

edtSum.Text := IntToStr(Sum);
end;

end.

27 changes: 22 additions & 5 deletions 20_Task/M1/20_Function/FunctionForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ TForm2 = class(TForm)
private
// �� ��(����)���� ����ϴ� ������ �Լ��� ����
function GetNameMsg(AName: string): string;

function GetAgeMsg(AName: string; AAge: Integer): string;
function GetUserInfoMsg(AName:string; AAge:Integer; AGender:Boolean):string;
{ TODO :
(2-1) GetUserInfoMsg �Լ��� ����
�Ķ����: �̸�(����), ����(����), ���ڿ���(Boolean)
Expand All @@ -47,26 +47,31 @@ function TForm2.GetNameMsg(AName: string): string;
var
Msg: string;
begin
Msg := '�ȳ��ϼ���. ';
Msg := '�ݰ����ϴ�. ';
Msg := Msg + AName + '��';

Result := Msg;
end;



function TForm2.GetAgeMsg(AName: string; AAge: Integer): string;
var
Msg, Adult: string;
begin
Msg := GetNameMsg(AName); // �λ縻 ǥ�ô� ����
Msg := Msg + #13#10; // ���� ��������(�ϸ� ij��������)

{ TODO :
(1) Msg ������ '(AName)���� (AAge)���� (����/�̼���)�Դϴ�.' �޽��� �߰�
if ���� �̿��� 20�� �̻�(>=)�� ��� �������� �Ǵ�
���ڿ��� ������ ����(���ϱ�) �ϼ���.
������ ���ڷ� ��ȯ(IntToStr)�ϼ���.
}

if AAge>=20 then
Adult:='����'
else
Adult:='�̼���';
Msg := Msg + AName+'���� '+INTTOSTR(AAge)+'���� ('+Adult+')�Դϴ�.';
Result := Msg;
end;

Expand Down Expand Up @@ -109,7 +114,7 @@ procedure TForm2.Button3Click(Sender: TObject);
��ȯ�ϴ� �Լ�(GetUserInfoMsg)�� �ۼ��ϼ���
Msg := GetUserInfoMsg(Name, Age, IsMan);
}

Msg := GetUserInfoMsg(Name, Age, IsMan);
ShowMessage(Msg);
end;

Expand All @@ -118,4 +123,16 @@ procedure TForm2.Button3Click(Sender: TObject);
�λ縻 + ���ο��� Ȯ�� + ����Ȯ�� �޽����� ��ȯ�ϵ��� �ۼ��ϼ���.
�̹� ������ GetNameMsg, GetAgeMsg ���� �����ϼ���.
}
function TForm2.GetUserInfoMsg(AName: string; AAge: Integer; AGender: Boolean): string;
var
Msg, Gender:string;
begin
Msg:=GetAgeMsg(AName, AAge)+#13#10;;
if AGender then
Gender:='����'
else
Gender:='����';
Msg:= Msg + AName+'���� '+Gender+'�Դϴ�.';
result:=Msg;
end;
end.
24 changes: 24 additions & 0 deletions 20_Task/M1/30_Array/ArrayForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ procedure TForm3.Button1Click(Sender: TObject);
I: Integer;
Sum, MaxNum: Integer;
begin
InitArray;
// �迭�� ��
Sum := GetArraySum;

Expand All @@ -65,6 +66,10 @@ procedure TForm3.Button1Click(Sender: TObject);
�迭�� ũ�� ����ǵ� �����ϵ��� �ݺ��� ���� Length(FNumArr) - 1�� ����
��> for I := 0 to Length(FNumArr) - 1 do }


for I := 0 to Length(FNumArr)-1 do
Memo1.Lines.Add(' - '+inttostr(FNumArr[I]));

Memo1.Lines.Add('�迭�� ���� ' + IntToStr(Sum) + ' �Դϴ�.');
Memo1.Lines.Add('�迭�� �ִ밪�� ' + IntToStr(MaxNum) + ' �Դϴ�.');
end;
Expand All @@ -76,6 +81,10 @@ function TForm3.GetArraySum: Integer;
Sum := 0;
{ TODO : (2) for ���� �̿��� �迭�� ���� ��� ���� ��ȯ�ϵ��� ���� }


for I := 0 to Length(FNumArr)-1 do
Sum := Sum+FNumArr[i];

Result := Sum;
end;

Expand All @@ -87,6 +96,11 @@ function TForm3.GetArrayMaxNum: Integer;
{ TODO :
(3) for ���� �̿��� �迭�� �� �� ���� ū ���� ��ȯ�ϵ��� ����
if ���� �̿��� ���ڸ� �� }
for I := 0 to Length(FNumArr)-1 do
begin
if(MaxNum<=FNumArr[I]) then
MaxNum:= FNumArr[I];
end;

Result := MaxNum;
end;
Expand All @@ -103,9 +117,19 @@ procedure TForm3.Button2Click(Sender: TObject);
50 �̻�(>=)�� ��� CountOver 1 ����
50 �̸�(<)�� ��� CountUnder 1 ���� �ϵ��� ����
}
for I := 0 to Length(FNumArr)-1 do
begin
if FNumArr[i]>=50 then
inc(CountOver)
else if FNumArr[i]<50 then
inc(CountUnder);

end;


Memo1.Lines.Add('50 �̻��� ���� ����: ' + IntToStr(CountOver));
Memo1.Lines.Add('50 �̸��� ���� ����: ' + IntToStr(CountUnder));
end;

end.

Empty file removed 30_Test/readme.md
Empty file.
File renamed without changes.