Автор работы: Пользователь скрыл имя, 18 Ноября 2009 в 19:23, Не определен
Курсовая работа по программе Паскаль
задача №2
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
memo: TMemo;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var i,j,b,k:integer;
a:array [1..3267] of integer;
begin
a[1]:=2;
j:=1;
for i:=3 to strtoint(edit1.text) do begin
b:=1;
for k:=1 to j do if ((i mod a[k])=0) then b:=0;
if b=1 then
begin
j:=j+1;
a[j]:=i;
end;
end;
if edit1.Text=inttostr(1) then memo.Text:=inttostr(1);
if edit1.Text=inttostr(2) then memo.Text:=inttostr(2);
if b=1 then memo.Text:=edit1.Text;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
memo.text:=' ';
end;
end.
задача №3
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
ScrollBar1: TScrollBar;
procedure ScrollBar1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.ScrollBar1Change(
begin
edit1.Width:=scrollbar1.
end;
end.
задача №4
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus;
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
procedure N3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.N3Click(Sender: TObject);
begin
application.terminate;
end;
end.
задача №5
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
SaveDialog1: TSaveDialog;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var f:textfile;
begin
savedialog1.DefaultExt:='txt';
savedialog1.Filter:='текстовый файл(*.txt)|*.txt';
if savedialog1.Execute then begin
assignfile(f, savedialog1.FileName);
rewrite(f);
write(f,edit1.Text);
end;
closefile(f);
end;
end.
задача №6
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, StdCtrls;
type
TForm1 = class(TForm)
CheckBox1: TCheckBox;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure N3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.N1Click(Sender: TObject);
begin
checkbox1.Color:=clred;
checkbox1.font.Color:=clgreen;
end;
procedure TForm1.N2Click(Sender: TObject);
begin
checkbox1.Color:=clblack;
checkbox1.font.Color:=clwhite;
end;
procedure TForm1.N3Click(Sender: TObject);
begin
checkbox1.Color:=clwhite;
checkbox1.font.Color:=clblack;
end;
end.
задача №7
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
x: TEdit;
y: TEdit;
z: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
RadioGroup1: TRadioGroup;
Label5: TLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if RadioGroup1.Itemindex=0 then
label5.Caption:=inttostr(
else if RadioGroup1.Itemindex=1 then
label5.Caption:=inttostr(
else if RadioGroup1.ItemIndex=2 then
label5.Caption:=inttostr(sqr(
else label5.Caption:=inttostr(
end;
end.
задача №8
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
ListBox1: TListBox;
Button1: TButton;
Image1: TImage;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Image1.Picture.LoadFromFile(
end;
end.
задача №9
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, StdCtrls;
type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
Edit2: TEdit;
Label3: TLabel;
Edit3: TEdit;
Label4: TLabel;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var i:integer;
begin
for i:=1 to 10 do begin
stringgrid1.Cells[0,i]:='
stringgrid1.Cells[1,i]:=
end;
stringgrid1.Cells[1,0]:='очки'
end;
procedure TForm1.Button1Click(Sender: TObject);
var t,m,s,max:integer;
rab:string;
begin
t:=strtoint(edit2.Text);
m:=strtoint(edit3.Text);
StringGrid1.Cells[1,t]:= inttostr(m);
end;
end.
задача №10
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TeEngine, Series, StdCtrls, ExtCtrls, TeeProcs, Chart;
type
TForm1 = class(TForm)
Chart1: TChart;
Button1: TButton;
Series1: TPointSeries;
OpenDialog1: TOpenDialog;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var f:textfile;
b:array [1..10] of double;
a:array [1..10] of string;
i:integer;
begin
opendialog1.DefaultExt:='txt';
opendialog1.Filter:='*.txt|*.
if opendialog1.Execute then
assignfile(f, opendialog1.FileName);
reset(f);
for i:=1 to 10 do begin
readln(f,a[i]);
b[i]:=strtoint(a[i]);
end;
chart1.Series[0].AddArray(b);
Информация о работе Программирование на языках высокого уровня