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: 6 additions & 1 deletion 20_Task/M1/10_Variable/VariableForm.pas
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
unit VariableForm;

interface
//����� �׽�Ʈ

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Expand All @@ -15,12 +16,14 @@ TForm1 = class(TForm)
Label2: TLabel;
procedure Button1Click(Sender: TObject);
private
FSum:integer;
// �� ��(����)������ ����ϴ� ������ �Լ��� ����

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

function AddNum(ANum: Integer): Integer;
public

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

Expand All @@ -33,10 +36,12 @@ implementation

function TForm1.AddNum(ANum: Integer): Integer;
begin
result := 0;
FSum := FSum + ANum;
{ TODO :
(2) FSum ������ �Ķ���� ANum ���� ���մϴ�.
FSum ���� ��ȯ }
Result := 0;
Result := FSum;
end;

procedure TForm1.Button1Click(Sender: TObject);
Expand Down
25 changes: 24 additions & 1 deletion 20_Task/M1/20_Function/FunctionForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ TForm2 = class(TForm)
function GetNameMsg(AName: string): string;

function GetAgeMsg(AName: string; AAge: Integer): string;
{ TODO :

function GetUserInfoMsg(AName: string; AAge: Integer; AGender : Boolean) : string;
{ TODO :
(2-1) GetUserInfoMsg �Լ��� ����
�Ķ����: �̸�(����), ����(����), ���ڿ���(Boolean)
��ȯ��: ���ڿ�(�޽���)
Expand All @@ -53,12 +55,32 @@ function TForm2.GetNameMsg(AName: string): string;
Result := Msg;
end;

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;

function TForm2.GetAgeMsg(AName: string; AAge: Integer): string;
var
Msg, Adult: string;
begin
Msg := GetNameMsg(AName); // �λ縻 ǥ�ô� ����
Msg := Msg + #13#10; // ���� ��������(�ϸ� ij��������)
if AAge>=20 then
Adult:='����'
else
Adult:='�̼���';
Msg := Msg+AName+'����'+IntToStr(AAge)+'����'+(Adult)+'�Դϴ�.';


{ TODO :
(1) Msg ������ '(AName)���� (AAge)���� (����/�̼���)�Դϴ�.' �޽��� �߰�
Expand Down Expand Up @@ -103,6 +125,7 @@ procedure TForm2.Button3Click(Sender: TObject);
Name := edtName.Text;
Age := StrToInt(edtAge.Text);
IsMan := rdoMan.Checked;
Msg := GetUserInfoMsg(Name,Age,Isman);

{ TODO :
(2) �λ縻 + ���ο��� Ȯ�� + ����Ȯ�� �޽�����
Expand Down
17 changes: 16 additions & 1 deletion 20_Task/M1/30_Array/ArrayForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ procedure TForm3.Button1Click(Sender: TObject);

Memo1.Lines.Clear;
Memo1.Lines.Add('�迭 ����');

for I := 0 to Length(FNumArr)-1 do
Memo1.Lines.Add(IntToStr(FNumArr[I]));
{ TODO :
(1) for ���� �̿��� �迭�� ������ ����ϼ���.
�迭�� ũ�� ����ǵ� �����ϵ��� �ݺ��� ���� Length(FNumArr) - 1�� ����
Expand All @@ -74,6 +75,8 @@ function TForm3.GetArraySum: Integer;
I, Sum: Integer;
begin
Sum := 0;
for I := 0 to Length(FNumArr)-1 do
Sum := Sum+FNumArr[i];
{ TODO : (2) for ���� �̿��� �迭�� ���� ��� ���� ��ȯ�ϵ��� ���� }

Result := Sum;
Expand All @@ -84,6 +87,11 @@ function TForm3.GetArrayMaxNum: Integer;
I, MaxNum: Integer;
begin
MaxNum := 0;
for I := 0 to Length(FNumArr)-1 do
begin
if(MaxNum<=FNumArr[I]) then
MaxNum:= FNumArr[I];
end;
{ TODO :
(3) for ���� �̿��� �迭�� �� �� ���� ū ���� ��ȯ�ϵ��� ����
if ���� �̿��� ���ڸ� �� }
Expand All @@ -98,6 +106,13 @@ procedure TForm3.Button2Click(Sender: TObject);
begin
CountOver := 0;
CountUnder := 0;
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;
{ TODO :
(4) for ���� �̿��� �迭�� ����
50 �̻�(>=)�� ��� CountOver 1 ����
Expand Down
53 changes: 53 additions & 0 deletions 20_Task/M1/leejaeho-123/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
53 changes: 53 additions & 0 deletions 20_Task/M1/leejaeho-123/10_Variable/VariableForm.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
unit VariableForm;

interface
//����� �׽�Ʈ

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

type
TForm1 = class(TForm)
Label1: TLabel;
edtNum: TEdit;
Button1: TButton;
edtSum: TEdit;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
private
// �� ��(����)������ ����ϴ� ������ �Լ��� ����

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

function AddNum(ANum: Integer): Integer;
public
// �ٸ� ���ֿ��� ������ �� �ִ� ������ �Լ� ����
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

function TForm1.AddNum(ANum: Integer): Integer;
begin
{ TODO :
(2) FSum ������ �Ķ���� ANum ���� ���մϴ�.
FSum ���� ��ȯ }
Result := 0;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
Num, Sum: Integer; // �̰��� ����� ������ �� �Լ������� ����մϴ�.
begin
Num := StrToInt(edtNum.Text);
Sum := AddNum(Num);

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

end.
14 changes: 14 additions & 0 deletions 20_Task/M1/leejaeho-123/10_Variable/VariableSample.dpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
program VariableSample;

uses
Vcl.Forms,
VariableForm in 'VariableForm.pas' {Form1};

{$R *.res}

begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
Loading