-
Notifications
You must be signed in to change notification settings - Fork 0
/
GERADE.PAS
executable file
·173 lines (167 loc) · 3.37 KB
/
GERADE.PAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
program gerade;
uses crt,graph;
var
k,treiber,modus:integer;
dx,a,b,x,y,x0,x1,y0,y1:real;
wahl:char;
ortx6,ortx1,ortx2,ortx3,ortx4,ortx5:string;
procedure graphik;
begin
treiber:=detect;
initgraph(treiber,modus,'');
setbkcolor(1);
setcolor(15);
line(10,30,630,30);
line(10,450,630,450);
line(10,30,10,450);
line(630,30,630,450);
outtextxy(235,15,'Gerade y = a * x + b');
outtextxy(15,455,'a vergrӇern (A) b vergrӇern (B) a und b vorgeben (v)');
outtextxy(15,465,' verkleinern (a) verkleinern (b) Startwerte (w) beenden (x) ');
end;
procedure setz;
begin
setcolor(15);
outtextxy(300,397,'-4');
outtextxy(300,357,'-3');
outtextxy(300,317,'-2');
outtextxy(300,277,'-1');
outtextxy(310,197,'1');
outtextxy(310,157,'2');
outtextxy(310,117,'3');
outtextxy(310,77,'4');
outtextxy(358,245,'1');
outtextxy(398,245,'2');
outtextxy(438,245,'3');
outtextxy(478,245,'4');
outtextxy(518,245,'5');
outtextxy(558,245,'6');
outtextxy(275,245,'-1');
outtextxy(235,245,'-2');
outtextxy(195,245,'-3');
outtextxy(155,245,'-4');
outtextxy(115,245,'-5');
outtextxy(75,245,'-6');
line(60,240,580,240);
line(320,60,320,420);
setlinestyle(1,0,1);
line(60,280,580,280);
line(60,320,580,320);
line(60,360,580,360);
line(60,400,580,400);
line(60,200,580,200);
line(60,160,580,160);
line(60,120,580,120);
line(60,80,580,80);
line(360,60,360,420);
line(400,60,400,420);
line(440,60,440,420);
line(480,60,480,420);
line(520,60,520,420);
line(560,60,560,420);
line(80,60,80,420);
line(120,60,120,420);
line(160,60,160,420);
line(200,60,200,420);
line(240,60,240,420);
line(280,60,280,420);
setlinestyle(0,0,1);
x0:=-280;
dx:=0.2;
repeat
x0:=x0+dx;
y0:=a*x0+40*b;
if (y0<=180) and (y0>=-180) then
begin
putpixel(320+round(x0),240-round(y0),14);
end;
until x0>=280;
setcolor(14);
str(a:4:2,ortx1);
outtextxy(445,430,ortx1);
str(b:4:2,ortx2);
outtextxy(540,430,ortx2);
outtextxy(410,430,'y = * x +');
end;
procedure loesch;
begin
setcolor(1);
x0:=-289;
dx:=0.2;
repeat
x0:=x0+dx;
y0:=a*x0+40*b;
if (y0<=180) and (y0>=-180) then
begin
putpixel(320+round(x0),240-round(y0),1);
end;
until x0>=280;
outtextxy(445,430,ortx1);
outtextxy(540,430,ortx2);
end;
procedure ausgabe;
begin
a:=1;
b:=0;
setz;
wahl:=' ';
repeat
if keypressed then wahl:=readkey;
case wahl of
'a':
begin
loesch;
a:=a-0.01;
setz;
wahl:=' ';
end;
'A':
begin
loesch;
a:=a+0.01;
setz;
wahl:=' ';
end;
'b':
begin
loesch;
b:=b-0.05;
setz;
wahl:=' ';
end;
'B':
begin
loesch;
b:=b+0.05;
setz;
wahl:=' ';
end;
'w':
begin
loesch;
a:=1;
b:=0;
setz;
wahl:=' ';
end;
'v':
begin
setcolor(14);
outtextxy(40,430,'a eingeben');
read(a);
outtextxy(40,440,'b eingeben');
read(b);
loesch;
graphik;
setz;
wahl:=' ';
end;
'p':wahl:=readkey;
end;
until wahl='x';
end;
{Main}
begin
graphik;
ausgabe;
end.