Jump to content

Доработка программы: добавить действия по пунктам меню - PascalABC.NET


Recommended Posts

плиз, доделайте программу.
У меня есть меню и мне надо вставить туда программу в пункт «Нарисовать астроиду", и в пункт "Справка" написать текст
Код меню:

PascalВыделить
 
uses  GraphABC;
const
  x0 = 150;
  y0 = 200;
  w = 100;
  step = 120;
  n = 3;
  kv1=0;
  kv2=1;
  kv3=2;
var f:integer;
Q: array[1..3] of string= ('Нарисовать астроиду','Справка','Выход');
  procedure menu(f: integer);
var i:integer;
begin
for i:=1 to 3 do
begin
setfontsize(10);
if f=i then setfontcolor(clred) else setfontcolor(clgreen);
textout(200,100+i*30,Q[i]);
end;
end;
Procedure choose;
begin
case f of
1: begin; textout (1,1,'да');end;
3: halt;
end;
end;
procedure up;
begin if f=1 then f:=3 else f:=f-1; clearwindow; menu(f); end;
procedure down ;
begin if f=3 then f:=1 else f:=f+1; clearwindow; menu(f); end;
procedure KeyDown(Key: integer);                         
begin
case Key of
VK_Up: up;
VK_Down: down;
VK_Enter: begin; choose;end;
end;
end;
begin                 
f:=1;
menu(f);
OnKeyDown := KeyDown;
end.
Код программы:
uses
graphabc;
var
r, xc, yc, x1, y1: integer;
x, y, t: real;
s: string;
 
begin
repeat
write('Vvedite radius [50..200] r=');
readln(r);
until r in [50..200];
SetWindowSize(400, 400);
xc := WindowWidth div 2;
yc := WindowHeight div 2;
line(0, yc, 2 * xc, yc);
line(xc, 0, xc, 2 * yc);
t := 0;
while t <= 2 * pi do
begin
x := r * (sqr(cos(t)) * cos(t));
y := r * (sqr(sin(t)) * sin(t));
x1 := xc + round(x);
y1 := yc - round(y);
putpixel(x1, y1, clGreen);
t := t + 0.001;
end;
SetBrushColor(clGreen);
//setfillstyle(6, 12);
//floodfill(xc, yc, clGreen);
textout(50, 40, 'Astroida');
textout(50, 60, 'x=r*cos^3(t) y=r*sin^3(t)');
str(r, s);
textout(50, 80, 'pri R=' + s);
end.
Текст у меню "Справка":
Астроида это кривая, которую описывает фиксированная точка круга, с середины касаясь неподвижного круга раза большего радиуса, и катится по нему без скольжения

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...