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
6 changes: 5 additions & 1 deletion 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,6 +20,7 @@ TForm1 = class(TForm)
// �� ��(����)������ ����ϴ� ������ �Լ��� ����

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

function AddNum(ANum: Integer): Integer;
public
Expand All @@ -36,7 +39,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
28 changes: 24 additions & 4 deletions 20_Task/M1/20_Function/FunctionForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ TForm2 = class(TForm)
function GetNameMsg(AName: string): string;

function GetAgeMsg(AName: string; AAge: Integer): string;
function GetUserInfoMsg(AName: string; AAge: Integer; IsMan : boolean): string;
{ TODO :
(2-1) GetUserInfoMsg �Լ��� ����
�Ķ����: �̸�(����), ����(����), ���ڿ���(Boolean)
Expand Down Expand Up @@ -53,23 +54,42 @@ function TForm2.GetNameMsg(AName: string): string;
Result := Msg;
end;

function TForm2.GetUserInfoMsg(AName: string; AAge: Integer;
IsMan: boolean): string;
var AMan,Msg : string;
begin
AMan := '����';
if Isman = false then
AMan := '����';

Msg := GetAgeMsg(AName, AAge );
Msg := Msg + #13#10 + AName + '�� ��' + AMan + '�Դϴ�.' ;

result := Msg;
end;

function TForm2.GetAgeMsg(AName: string; AAge: Integer): string;
var
Msg, Adult: string;
Msg: string;
Adult : string;
begin
Adult := '�̼���';
if AAge >= 20 then
Adult := '����';

Msg := GetNameMsg(AName); // �λ縻 ǥ�ô� ����
Msg := Msg + #13#10; // ���� ��������(�ϸ� ij��������)
Msg := Msg + #13#10 + AName + '���� ' + inttostr(AAge) + '���� ' + Adult + '�Դϴ�.' ; // ���� ��������(�ϸ� ij��������)

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

Result := Msg;
end;


procedure TForm2.Button1Click(Sender: TObject);
var
Name, Msg: string;
Expand Down Expand Up @@ -104,12 +124,12 @@ procedure TForm2.Button3Click(Sender: TObject);
Age := StrToInt(edtAge.Text);
IsMan := rdoMan.Checked;

MSg := GetUserInfoMsg(Name, Age, IsMan);
{ TODO :
(2) �λ縻 + ���ο��� Ȯ�� + ����Ȯ�� �޽�����
��ȯ�ϴ� �Լ�(GetUserInfoMsg)�� �ۼ��ϼ���
Msg := GetUserInfoMsg(Name, Age, IsMan);
}

ShowMessage(Msg);
end;

Expand Down
Binary file modified 20_Task/M1/20_Function/FunctionSample.res
Binary file not shown.
14 changes: 14 additions & 0 deletions 20_Task/M1/30_Array/ArrayForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ 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 @@ -75,6 +78,8 @@ function TForm3.GetArraySum: Integer;
begin
Sum := 0;
{ TODO : (2) for ���� �̿��� �迭�� ���� ��� ���� ��ȯ�ϵ��� ���� }
for I := 0 to length(Fnumarr)-1 do
Sum := sum + Fnumarr[i];

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

Result := MaxNum;
end;
Expand All @@ -104,6 +112,12 @@ procedure TForm3.Button2Click(Sender: TObject);
50 �̸�(<)�� ��� CountUnder 1 ���� �ϵ��� ����
}

for I := 0 to length(Fnumarr)-1 do
if Fnumarr[i] >= 50 then
inc(CountOver) ;
if Fnumarr[i] < 50 then
inc(Countunder) ;

Memo1.Lines.Add('50 �̻��� ���� ����: ' + IntToStr(CountOver));
Memo1.Lines.Add('50 �̸��� ���� ����: ' + IntToStr(CountUnder));
end;
Expand Down
37 changes: 37 additions & 0 deletions 20_Task/M2/M2(calculation)_yangmyungwhan/Project1.dpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<<<<<<< HEAD
program Project1;

uses
Vcl.Forms,
���� in '����.pas' {Form1},
Vcl.Themes,
Vcl.Styles;

{$R *.res}

begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
TStyleManager.TrySetStyle('Sky');
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
=======
program Project1;

uses
Vcl.Forms,
���� in '����.pas' {Form1},
Vcl.Themes,
Vcl.Styles;

{$R *.res}

begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
TStyleManager.TrySetStyle('Sky');
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
>>>>>>> ea544203bcbbc8ff04b6fd585b9049812dbf02e4
Loading