




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
/XX大學(xué)遠程教育學(xué)院《數(shù)據(jù)庫應(yīng)用程序設(shè)計》課程作業(yè)姓名:學(xué)號:年級:學(xué)習(xí)中心:—————————————————————————————作業(yè)第一章1.5如何保存Delphi的項目?嘗試自己動手創(chuàng)建一個項目,并保存。答:執(zhí)行File|Save
All菜單命令或單擊工具欄中的Save
All按鈕便可保存,在保存時可以對工程文件和單元文件進行改名,但后綴名不能改。保存文件之后,單擊工具中的Run按鈕或按F9鍵,系統(tǒng)將開始編譯、連接、運行該工程。1.7嘗試設(shè)計如圖1-10所示的窗體?!矆D見教材P15頁圖1-10圖1-10第二章2.8設(shè)計如圖2-5所示的界面。單擊"按鈕1”或"按鈕2”時在標(biāo)簽上顯示用戶所執(zhí)行的操作。單擊"開啟/停用按鈕"可控制"按鈕1”和"按鈕2”是否可用,單擊"退出系統(tǒng)"按鈕時,結(jié)束程序的運行。2.9設(shè)計如圖2-6所示的界面。當(dāng)單擊按鈕時,可控制文本框中字體的顏色。圖2-5 圖2-6
unit
test;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls;
type
TForm1
=
class<TForm>
showLabel:
TLabel;
btn1:
TButton;
//按鈕1
btn2:
TButton;
//按鈕2
ctlBtn:
TButton;
//開啟停用按鈕exitBtn:
TButton;
//退出按鈕procedure
btn1Click<Sender:
TObject>;
procedure
btn2Click<Sender:
TObject>;
procedure
exitBtnClick<Sender:
TObject>;
procedure
ctlBtnClick<Sender:
TObject>;
private
{
Private
declarations
}
public
{
Public
declarations
}
end;
var
Form1:
TForm1;
ctlStatus:integer
=
0;
//控制按鈕1和2的開啟和關(guān)閉,0表示當(dāng)前為開啟,1表示關(guān)閉implementation
{$R
*.dfm}
procedure
TForm1.btn1Click<Sender:
TObject>;begin
form1.showLabel.Caption
:=
'您點擊了按鈕1';
end;
procedure
TForm1.btn2Click<Sender:
TObject>;
begin
form1.showLabel.Caption
:=
'您點擊了按鈕2';
end;
procedure
TForm1.exitBtnClick<Sender:
TObject>;
begin
form1.Close;
end;
procedure
TForm1.ctlBtnClick<Sender:
TObject>;
begin
if
ctlStatus
=
0
then
begin
form1.btn1.Enabled
:=
false;
form1.btn2.Enabled
:=
false;
ctlStatus
:=
1;
end
else
begin
form1.btn1.Enabled
:=
true;
form1.btn2.Enabled
:=
true;
ctlStatus
:=
0;
end;
end;
end.
2.9:unit
test;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls;
type
TForm1
=
class<TForm>
Label1:
TLabel;
Edit1:
TEdit;
btnRed:
TButton;
btnGreen:
TButton;
btnBlue:
TButton;
procedure
btnRedClick<Sender:
TObject>;
procedure
btnGreenClick<Sender:
TObject>;
procedure
btnBlueClick<Sender:
TObject>;
private
{
Private
declarations
}
public
{
Public
declarations
}
end;
var
Form1:
TForm1;
implementation
{$R
*.dfm}
procedure
TForm1.btnRedClick<Sender:
TObject>;
begin
form1.Edit1.Font.Color
:=
clred;end;
procedure
TForm1.btnGreenClick<Sender:
TObject>;
begin
form1.Edit1.Font.Color
:=
clgreen;
end;
procedure
TForm1.btnBlueClick<Sender:
TObject>;
begin
form1.Edit1.Font.Color
:=
clblue;
end;
end.第三章3.8下列實數(shù)中哪些是合法的,哪些是不合法的?不合法的請說明理由?!睞0.25E+02 〔B.25+2 〔C25E+2〔D34.5 〔E.123 〔F-3E-4〔A合法,即為25
〔B不合法,小數(shù)點前必須有數(shù)字,如表示為0.25+2
〔C合法,即為2500
〔D合法,即為34.5
〔E不合法,同〔2
〔F合法,即為‐0.0003
3.12數(shù)學(xué)式子sin30。寫成Delphi表達式是下列哪個?〔ASin30 〔BSin<30> 〔CSIN〔30?!睤Sin<30*Pi/180>D,需要把角度轉(zhuǎn)化為弧度第四章4.7利用3個數(shù)字編輯框分別輸入小時、分、秒,換算共有多少秒,然后使用標(biāo)簽輸出。unit
test;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls,
Spin;
type
TForm1
=
class<TForm>
SpinEdit1:
TSpinEdit;
Label1:
TLabel;
Label2:
TLabel;
SpinEdit2:
TSpinEdit;
Label3:
TLabel;
SpinEdit3:
TSpinEdit;
Label4:
TLabel;
procedure
SpinEdit1Change<Sender:
TObject>;
procedure
SpinEdit2Change<Sender:
TObject>;
procedure
SpinEdit3Change<Sender:
TObject>;
private
{
Private
declarations
}
procedure
CalculateTimeToSencond<timeKind:String;
time:integer>;
public
{
Public
declarations
}
end;
var
Form1:
TForm1;
hour:
integer
=
0;
minute:
integer
=
0;
second:
integer
=
0;
tot:integer
=
0;
implementation
{$R
*.dfm}
procedure
TForm1.CalculateTimeToSencond<timeKind:String;
time:integer>;
begin
if
timeKind
=
'hh'
then
hour
:=
time
else
if
timeKind
=
'mi'
then
minute
:=
time
else
if
timeKind
=
'ss'
then
second
:=
time;
tot
:=
hour
*
60
*
60
+
minute
*
60
+
second;
form1.Label4.Caption
:=
'總共為'
+
IntToStr<tot>
+
'秒';
end;
procedure
TForm1.SpinEdit1Change<Sender:
TObject>;
begin
Form1.CalculateTimeToSencond<'hh',
StrToInt<Form1.SpinEdit1.Text>>;
end;
procedure
TForm1.SpinEdit2Change<Sender:
TObject>;
begin
Form1.CalculateTimeToSencond<'mi',
StrToInt<Form1.SpinEdit2.Text>>;
end;
procedure
TForm1.SpinEdit3Change<Sender:
TObject>;
begin
Form1.CalculateTimeToSencond<'ss',
StrToInt<Form1.SpinEdit3.Text>>;
end;
end.
4.8在編輯框中輸入一個實數(shù),利用備注框輸出該實數(shù)及其平方和平方根。unit
Unit1;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls;
type
TForm1
=
class<TForm>
Edit1:
TEdit;
Label1:
TLabel;
Memo1:
TMemo;
Label2:
TLabel;
procedure
Edit1Change<Sender:
TObject>;
private
{
Private
declarations
}
public
{
Public
declarations
}
end;
var
Form1:
TForm1;
num1
:
Real;
//原實數(shù)
num2
:
Real;
//實數(shù)平方num3
:
Real;
//實數(shù)平方根
implementation
{$R
*.dfm}
procedure
TForm1.Edit1Change<Sender:
TObject>;
begin
if
form1.Edit1.Text
<>
''
then
begin
num1
:=
StrToFloat<form1.Edit1.Text>;
num2
:=
Sqr<num1>;
num3
:=
Sqrt<num1>;
form1.Memo1.Lines.Clear;
form1.Memo1.Lines.Add<'實數(shù)為
:
'
+
FloatToStr<num1>>;
form1.Memo1.Lines.Add<'平方為
:
'
+
FloatToStr<num2>>;
form1.Memo1.Lines.Add<'平方根為
:
'
+
FloatToStr<num3>>;
end;
end;
end.第五章5.11任意給定3個實數(shù),按照從大到小的順序依次輸出這3個數(shù)。unit
Unit1;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls;
type
TForm1
=
class<TForm>
num1Edit:
TEdit;
Label1:
TLabel;
Label2:
TLabel;
resultLabel:
TLabel;
num2Edit:
TEdit;
num3Edit:
TEdit;
procedure
num1EditChange<Sender:
TObject>;
procedure
num2EditChange<Sender:
TObject>;
procedure
num3EditChange<Sender:
TObject>;
private
{
Private
declarations
}
procedure
CompareNumber<>;
public
{
Public
declarations
}
end;
var
Form1:
TForm1;
num1
:
Real;
//數(shù)字1
num2
:
Real;
//數(shù)字2
num3
:
Real;
//數(shù)字3
compnum
:
Real;
//比較時轉(zhuǎn)換2數(shù)outStr
:
String;
//輸出結(jié)果;
implementation
{$R
*.dfm}
procedure
TForm1.CompareNumber<>;
begin
if
<trim<form1.num1Edit.Text>
<>
''>
And
<trim<form1.num2Edit.Text>
<>
''>
And
<trim<form1.num3Edit.Text>
<>
''>
then
begin
num1
:=
StrToFloat<form1.num1Edit.Text>;
num2
:=
StrToFloat<form1.num2Edit.Text>;
num3
:=
StrToFloat<form1.num3Edit.Text>;
if
num2
>
num1
then
begin
compnum
:=
num1;
num1
:=
num2;
num2
:=
compnum;
end;
if
num3
>
num1
then
begin
compnum
:=
num1;
num1
:=
num3;
num3
:=
compnum;
end;
if
num3
>
num2
then
begin
compnum
:=
num2;
num2
:=
num3;
num3
:=
compnum;
end;
outStr
:=
FloatToStr<num1>
+
','
+
FloatToStr<num2>
+
','
+
FloatToStr<num3>;
form1.resultLabel.Caption
:=
outStr;
end;
end;
procedure
TForm1.num1EditChange<Sender:
TObject>;
begin
form1.CompareNumber;
end;
procedure
TForm1.num2EditChange<Sender:
TObject>;
begin
form1.CompareNumber;
end;
procedure
TForm1.num3EditChange<Sender:
TObject>;
begin
form1.CompareNumber;
end;
end.
5.13假設(shè)工資的增幅標(biāo)準(zhǔn)為:若基本工資大于等于1000元,增加工資20%;若小于1000元大于等于800元,則增加工資15%;若小于800元,則增加工資10%。請根據(jù)用戶在文本框中輸入的基本工資,計算出增加后的工資。unit
Unit1;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls;
type
TForm1
=
class<TForm>
Label1:
TLabel;
Edit1:
TEdit;
Label2:
TLabel;
resultLabel:
TLabel;
procedure
Edit1Change<Sender:
TObject>;
private
{
Private
declarations
}
public
{
Public
declarations
}
end;
var
Form1:
TForm1;
salary:
Real;
outSalary:
Real;
implementation
{$R
*.dfm}
procedure
TForm1.Edit1Change<Sender:
TObject>;
begin
salary
:=
StrToFloat<form1.Edit1.Text>;
if
<salary
>=
1000>
then
outSalary
:=
salary
*
<1
+
0.2>
else
if
<salary
<
1000>
And
<salary
>=
800>
then
outSalary
:=
salary
*
<1
+
0.15>
else
if
<salary
<
800>
then
outSalary
:=
salary
*
<1
+
0.1>;
form1.resultLabel.Caption
:=
FloatToStr<outSalary>;
end;
end.
第六章6.5設(shè)s=1X2X3X…Xn,求s不大于20000時最大的n。unit
Unit1;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls;
type
TForm1
=
class<TForm>
Label1:
TLabel;
Edit1:
TEdit;
Label2:
TLabel;
resultLabel:
TLabel;
procedure
FormCreate<Sender:
TObject>;
private
{
Private
declarations
}
public
{
Public
declarations
}
end;
var
Form1:
TForm1;
number,
n,
tot:
Integer;
implementation
{$R
*.dfm}
procedure
TForm1.FormCreate<Sender:
TObject>;
begin
tot
:=
1;
n
:=
0;
number
:=
StrToInt<form1.Edit1.Text>;
While
tot
<=
number
do
begin
n
:=
n
+
1;
tot
:=
tot
*
n;
end;
form1.resultLabel.Caption
:=
IntToStr<n‐1>;
end;
end.
6.10在標(biāo)簽上輸出100~200之間的所有的奇數(shù),其中3的倍數(shù)除外。unit
Unit1;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls;
type
TForm1
=
class<TForm>
resultLabel:
TLabel;
procedure
FormCreate<Sender:
TObject>;
private
{
Private
declarations
}
public
{
Public
declarations
}
end;
var
Form1:
TForm1;
number,
i:
Integer;
outStr:
String;
implementation
{$R
*.dfm}
procedure
TForm1.FormCreate<Sender:
TObject>;
begin
for
i:=
100
to
200
do
begin
if
i
mod
2
<>
0
then
if
i
mod
3
<>
0
then
outStr
:=
outStr
+
'
'
+
IntToStr<i>;
form1.resultLabel.Caption
:=
outStr;
end;
end;
end.第七章7.4求1~200這200個數(shù)的和,當(dāng)和大于10000時結(jié)束計算?!惨笫褂棉D(zhuǎn)向語句unit
Unit1;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls;
type
TForm1
=
class<TForm>
Label1:
TLabel;
procedure
FormCreate<Sender:
TObject>;
private
{
Private
declarations
}
public
{
Public
declarations
}
end;
var
Form1:
TForm1;
sum,
n
:
integer;
implementation
{$R
*.dfm}
procedure
TForm1.FormCreate<Sender:
TObject>;
begin
sum
:=
0;
n
:=
0;
repeat
n
:=
n
+
1;
sum
:=
sum
+
n;
if
<sum
>
10000>
then
break;
until
n
>=
200;
form1.Label1.Caption
:=
'總和為'
+
IntToStr<sum>;end;
end.
第八章8.8編寫函數(shù),輸出100~500之間所有能同時被3和13整除的數(shù)。unit
Unit1;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls;
type
TForm1
=
class<TForm>
Label1:
TLabel;
procedure
FormCreate<Sender:
TObject>;
private
{
Private
declarations
}
Function
checkNum<num:integer>:boolean;
public
{
Public
declarations
}
end;
var
Form1:
TForm1;
implementation
{$R
*.dfm}
Function
TForm1.checkNum<num:integer>:boolean;
var
n
:boolean;
begin
if
<num
mod
3
=
0>
And
<num
mod
13
=
0>
then
n
:=
true
else
n
:=
false;
result
:=
n;
end;
procedure
TForm1.FormCreate<Sender:
TObject>;
var
i
:
integer;
var
out
:
string;
begin
for
i
:=
100
to
500
do
begin
if
checkNum<i>
then
out
:=
out
+
'
'
+
IntToStr<i>;
end;
form1.Label1.Caption
:=
out;
end;
end.
第九章9.2打開對話框組件和打開圖片對話
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 工務(wù)段思想教育工作實施綱要
- 武警五一勞動活動方案
- 漢字期末展示活動方案
- 春節(jié)班級游戲活動方案
- 機關(guān)棋類活動方案
- 兒童國畫入門課件
- 泌尿外科中醫(yī)課件
- 學(xué)易金卷:段考模擬君之2025-2026學(xué)年高一歷史上學(xué)期第二次月考(11月)原創(chuàng)卷B卷(考試版)
- 關(guān)工委2025年度工作計劃
- 個人轉(zhuǎn)正工作總結(jié)
- 2025年政治理論時政熱點知識試題庫(附含答案)
- 造粒機銷售合同協(xié)議
- 森工集團考試試題及答案
- 糖尿病飲食試題及答案
- 2025年預(yù)應(yīng)力混凝土用鋼棒產(chǎn)品質(zhì)量監(jiān)督抽查實施細則
- XX市政道路路排水工程可行性研究報告
- 高級保育師試題(含答案)
- 基礎(chǔ)護理學(xué)練習(xí)題和答案
- 項目管理中期答辯
- 2025-2030中國美容院行業(yè)市場深度調(diào)研及發(fā)展趨勢和前景研究報告
- 2025年2月超算中心硬件維護技術(shù)服務(wù)合同
評論
0/150
提交評論