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
7 changes: 5 additions & 2 deletions 20_Task/M1/10_Variable/VariableForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

interface

// ����� �׽�Ʈ

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
Expand All @@ -18,7 +20,7 @@ TForm1 = class(TForm)
// �� ��(����)������ ����ϴ� ������ �Լ��� ����

{ TODO : (1) ���� �� FSum ������ �����ϼ���. }

Fsum : integer;
function AddNum(ANum: Integer): Integer;
public
// �ٸ� ���ֿ��� ������ �� �ִ� ������ �Լ� ����
Expand All @@ -36,7 +38,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 Down
26 changes: 25 additions & 1 deletion 20_Task/M1/20_Function/FunctionForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ TForm2 = class(TForm)
��ȯ��: ���ڿ�(�޽���)
(2-2) �Լ� ���� �� Ctrl + Shift + C�� ���� ������ ����
}
function GetUserInfoMsg(AName : string; AAge : Integer; Isman : Boolean) : string;
public
// �ٸ� ���ֿ��� ������ �� �ִ� ������ �Լ� ����
end;
Expand All @@ -53,6 +54,24 @@ function TForm2.GetNameMsg(AName: string): string;
Result := Msg;
end;

function TForm2.GetUserInfoMsg(AName: string; AAge: Integer; Isman: Boolean): string;
var
Msg, Sex : string;
begin
Msg := GetNameMsg(AName);
Msg := Msg + #13#10;
Msg := GetAgeMsg(AName, AAge);
Msg := Msg + #13#10;

if Isman = true then
Sex := '����'
else
Sex := '����';

Msg := Msg + AName + '���� ' + Sex + '�Դϴ�.';
Result := Msg;
end;

function TForm2.GetAgeMsg(AName: string; AAge: Integer): string;
var
Msg, Adult: string;
Expand All @@ -66,7 +85,12 @@ function TForm2.GetAgeMsg(AName: string; AAge: Integer): string;
���ڿ��� ������ ����(���ϱ�) �ϼ���.
������ ���ڷ� ��ȯ(IntToStr)�ϼ���.
}
if AAge >= 20 then
Adult := '����'
else
Adult := '�̼���';

Msg := Msg + Aname + '���� ' + IntToStr(AAge) + '���� ' + Adult + '�Դϴ�.';
Result := Msg;
end;

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

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

Expand Down
18 changes: 18 additions & 0 deletions 20_Task/M1/30_Array/ArrayForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ procedure TForm3.Button1Click(Sender: TObject);
(1) for ���� �̿��� �迭�� ������ ����ϼ���.
�迭�� ũ�� ����ǵ� �����ϵ��� �ݺ��� ���� Length(FNumArr) - 1�� ����
��> for I := 0 to Length(FNumArr) - 1 do }
for I := 0 to 9 do
begin
Memo1.Lines.Add('- ' + IntToStr(FNumArr[I]));
end;

Memo1.Lines.Add('�迭�� ���� ' + IntToStr(Sum) + ' �Դϴ�.');
Memo1.Lines.Add('�迭�� �ִ밪�� ' + IntToStr(MaxNum) + ' �Դϴ�.');
Expand All @@ -75,6 +79,10 @@ function TForm3.GetArraySum: Integer;
begin
Sum := 0;
{ TODO : (2) for ���� �̿��� �迭�� ���� ��� ���� ��ȯ�ϵ��� ���� }
for I := 0 to 9 do
begin
Sum := Sum + FNumArr[I];
end;

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

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

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