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
10 changes: 9 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,8 @@ TForm2 = class(TForm)
��ȯ��: ���ڿ�(�޽���)
(2-2) �Լ� ���� �� Ctrl + Shift + C�� ���� ������ ����
}
function GetUserInfoMsg(AName: string; AAge: Integer; Sex: Boolean): string; // GetUserInfoMsg �Լ� ����

public
// �ٸ� ���ֿ��� ������ �� �ִ� ������ �Լ� ����
end;
Expand All @@ -53,6 +55,12 @@ function TForm2.GetNameMsg(AName: string): string;
Result := Msg;
end;

function TForm2.GetUserInfoMsg(AName: string; AAge: Integer;
Sex: Boolean): string;
begin

end;

function TForm2.GetAgeMsg(AName: string; AAge: Integer): string;
var
Msg, Adult: string;
Expand All @@ -66,7 +74,7 @@ function TForm2.GetAgeMsg(AName: string; AAge: Integer): string;
���ڿ��� ������ ����(���ϱ�) �ϼ���.
������ ���ڷ� ��ȯ(IntToStr)�ϼ���.
}

// Msg := (AName)���� (AAge)���� (����/�̼���)�Դϴ�.
Result := Msg;
end;

Expand Down
53 changes: 53 additions & 0 deletions 20_Task/M1/shinsunghoon/10_Variable/VariableForm.dfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
object Form1: TForm1
Left = 0
Top = 0
Caption = #48320#49688#49324#50857' '#49892#49845' '#50696#51228
ClientHeight = 144
ClientWidth = 267
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 24
Top = 24
Width = 47
Height = 13
Caption = #49707#51088' '#51077#47141
end
object Label2: TLabel
Left = 24
Top = 77
Width = 58
Height = 13
Caption = #49707#51088#46308#51032' '#54633
end
object edtNum: TEdit
Left = 24
Top = 43
Width = 121
Height = 21
TabOrder = 0
end
object Button1: TButton
Left = 143
Top = 41
Width = 75
Height = 25
Caption = #51077#47141'(*)'
TabOrder = 1
OnClick = Button1Click
end
object edtSum: TEdit
Left = 24
Top = 96
Width = 121
Height = 21
TabOrder = 2
end
end
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,9 @@ function TForm1.AddNum(ANum: Integer): Integer;
{ TODO :
(2) FSum ������ �Ķ���� ANum ���� ���մϴ�.
FSum ���� ��ȯ }
Result := 0;
FSum := FSum + ANum; //FSum ������ �ױ�

Result := FSum; //��ȯ��
end;

procedure TForm1.Button1Click(Sender: TObject);
Expand Down
Binary file not shown.
96 changes: 96 additions & 0 deletions 20_Task/M1/shinsunghoon/20_Function/FunctionForm.dfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
object Form2: TForm2
Left = 0
Top = 0
Caption = #54632#49688#49324#50857' '#49892#49845' '#50696#51228
ClientHeight = 196
ClientWidth = 285
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 24
Top = 24
Width = 22
Height = 13
Caption = #51060#47492
end
object Label2: TLabel
Left = 24
Top = 77
Width = 22
Height = 13
Caption = #45208#51060
end
object Label3: TLabel
Left = 24
Top = 133
Width = 22
Height = 13
Caption = #49457#48324
end
object edtName: TEdit
Left = 24
Top = 43
Width = 121
Height = 21
TabOrder = 0
end
object Button1: TButton
Left = 151
Top = 41
Width = 75
Height = 25
Caption = #51064#49324#47568' '#54364#49884
TabOrder = 1
OnClick = Button1Click
end
object edtAge: TEdit
Left = 24
Top = 96
Width = 121
Height = 21
TabOrder = 2
end
object Button2: TButton
Left = 151
Top = 94
Width = 90
Height = 25
Caption = #49457#51064#50668#48512' '#54869#51064
TabOrder = 3
OnClick = Button2Click
end
object Button3: TButton
Left = 151
Top = 148
Width = 90
Height = 25
Caption = #49457#48324' '#54869#51064
TabOrder = 4
OnClick = Button3Click
end
object rdoMan: TRadioButton
Left = 24
Top = 152
Width = 49
Height = 17
Caption = #45224#51088
Checked = True
TabOrder = 5
TabStop = True
end
object rdoWoman: TRadioButton
Left = 79
Top = 152
Width = 49
Height = 17
Caption = #50668#51088
TabOrder = 6
end
end
170 changes: 170 additions & 0 deletions 20_Task/M1/shinsunghoon/20_Function/FunctionForm.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
unit FunctionForm;
/////////////////////////////////// ���� �Է¾��ҽ� ���� /////////////////////////////
interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
TForm2 = class(TForm)
Label1: TLabel;
edtName: TEdit;
Button1: TButton;
edtAge: TEdit;
Label2: TLabel;
Button2: TButton;
Label3: TLabel;
Button3: TButton;
rdoMan: TRadioButton;
rdoWoman: TRadioButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
// �� ��(����)���� ����ϴ� ������ �Լ��� ����
function GetNameMsg(AName: string): string;

function GetAgeMsg(AName: string; AAge: Integer): string;
{ TODO :
(2-1) GetUserInfoMsg �Լ��� ����
�Ķ����: �̸�(����), ����(����), ���ڿ���(Boolean)
��ȯ��: ���ڿ�(�޽���)
(2-2) �Լ� ���� �� Ctrl + Shift + C�� ���� ������ ����
}
function GetUserInfoMsg(AName: string; AAge: Integer; AIsMan: Boolean): string; //�������� �Լ� ����

public
// �ٸ� ���ֿ��� ������ �� �ִ� ������ �Լ� ����
end;

var
Form2: TForm2;

implementation

{$R *.dfm}

function TForm2.GetNameMsg(AName: string): string; //�̸� �Լ� ������
var
Msg: string; //�޽��� ���� ����
begin
Msg := '�ݰ����ϴ�. '; //�λ縻 �޽���
Msg := Msg + AName + '��'; //

Result := Msg; //��ȯ��
end;

function TForm2.GetUserInfoMsg(AName: string; AAge: Integer; //����Ȯ�� �Լ� ������
AIsMan: Boolean): string;
var
Msg, Gender: string; //�޽���, ���� ���� ����
begin
{ TODO :
(2-2) GetUserInfoMsg �Լ��� �����ο���
�λ縻 + ���ο��� Ȯ�� + ����Ȯ�� �޽����� ��ȯ�ϵ��� �ۼ��ϼ���.
�̹� ������ GetNameMsg, GetAgeMsg ���� �����ϼ���.
}
Msg := GetAgeMsg(AName,AAge); //�Լ� ȣ��
Msg := Msg + #13#10; //�ٹٲ�

if AIsMan then //����Ȯ�� ���ǹ�
Gender := '����' //
else //
Gender := '����'; //

Msg := Msg + AName + '���� ' + Gender + '�Դϴ�.'; //����Ȯ�� �޽���

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;

procedure TForm2.Button1Click(Sender: TObject);
var
Name, Msg: string;
begin
Name := edtName.Text;

Msg := GetNameMsg(Name);

ShowMessage(Msg);
end;

procedure TForm2.Button2Click(Sender: TObject);
var
Name, Msg: string;
Age: Integer;
begin
Name := edtName.Text;

if edtAge.Text = '' then //����Ȯ�� ���ǹ�
begin //���̾������� ����ó��
showmessage('���̸� �Է��ϼ���.');
exit ;
end
else
begin
Age := StrToInt(edtAge.Text);

Msg := GetAgeMsg(Name, Age);

ShowMessage(Msg);
end;
end;

procedure TForm2.Button3Click(Sender: TObject);
var
Name, Msg: string;
Age: Integer;
IsMan: Boolean;
begin
Name := edtName.Text;
//����Ȯ�� ���ǹ�
if edtAge.Text = '' then //���̾������� ����ó��
begin
showmessage('���̸� �Է��ϼ���.');
exit ;
end
else
begin
Age := StrToInt(edtAge.Text); //���� ������ ����
IsMan := rdoMan.Checked;
{ TODO :
(2) �λ縻 + ���ο��� Ȯ�� + ����Ȯ�� �޽�����
��ȯ�ϴ� �Լ�(GetUserInfoMsg)�� �ۼ��ϼ���
Msg := GetUserInfoMsg(Name, Age, IsMan);
}

Msg := GetUserInfoMsg(Name, Age, IsMan); //������ �Լ��� ȣ���� ����.

ShowMessage(Msg);


end;

end;


end.
Loading