if ErrCode = grOk then
begin
{ }
SetColor (red);
X:= Radius+2;
Y:= Radius+2;
Circle (X, Y, Radius);
SetFillStyle (1, red);
FloodFill (Radius, Radius, red);
{ }
Size:= ImageSize (0, 0, 2*X, 2*Y);
GetMem (P, Size);
GetImage (0, 0, 2*X, 2*Y, P^);
ClearDevice;
Repeat
{ }
for I:=1 to GetMaxX-2*X do
begin
PutImage (I, 1, P^, CopyPut);
Delay (10);
end;
{ }
for I:=1 to GetMaxY-2*Y do
begin
PutImage (GetMaxX-2*X, I, P^, CopyPut);
Delay (10);
end;
{ }
for I:=1 to GetMaxX-2*X do
begin
PutImage (GetMaxX-2*X-I, GetMaxY-2*Y, P^,CopyPut);
Delay (10);
end;
{ }
for I:=1 to GetMaxY-2*Y do
begin
PutImage (1, GetMaxY-2*X-I, P^, CopyPut);
Delay (10);
end;
{ }
Until KeyPressed;
FreeMem (P, Size);
CloseGraph;
end
else
Writeln(GraphErrorMsg(ErrCode));
End.
2.
"", .
2.1. ', .
2.2. - ', ' .
2.3. - ', .
2.4. - ', .
2.5. - ', .
2.6. - ', .
2.7. - ', .
2.8. ', .
2.9. ', .
2.10. ', .
|
|
3. Ͳ
3.1. '.
3.2. '.
3.3. .
3.4. .
3.5. ' .
3.6. .
3.7. ' '
3.8. ' '.
3.9. .
3.10. ' .
3.11. .
3.12. ' , .
3.13. .
' 9
-в ² ""
"" ᒺ- .
1. Ͳ ²Ҳ
1.1. ᒺ- () :
1). ᒺ , , ᒺ. . ˲ ᒺ object. ' . , ᒺ (TPerson) :
, ', Name;
Address;
Telephon;
-, :
Read_Date ;
Write_Date .
ϳ ᒺ ᒺ. ᒺ, , Tperson.Read_Date. With . ᒺ :
Type
TPerson= object
Name:string;
Address:string;
Telephon:string;
Procedure Read_Date;
Procedure Write_Date;
end;
Procedure TPerson.Read_Date;
begin
Write ('ϲ? ');
Readln (Name);
Write ('? ');
Readln (Address);
Write ('? ');
Readln (Telephon);
end;
Procedure TPerson.Write_Date;
begin
Writeln ('ϲ: ',Name);
Writeln (': ',Address);
Writeln (': ',Telephon);
end;
Var
Person:TPerson;
2). ᒺ ᒺ, . , ᒺ. . ' ᒺ object ᒺ. , ᒺ , ' , :
|
|
Type
TStudent= object (TPerson)
Institute:string;
Procedure Read_Date;
Procedure Write_Date;
end;
Procedure TStudent.Read_Date;
begin
TPerson.Read_Date;
Write ('? ');
Readln (Institute);
end;
Procedure TStudent.Write_Date;
begin
TPerson.Write_Date;
Writeln (': ',Institute);
end;
Var
Student:TStudent;
, ᒺ Read_Date Write_Date ;
3). ' Read_Date Write_Date, ' . .
1.2. ' ' , . , ' . , . ³ ' Virtual . ' . ' , , . ' Constructor () , ' Init.
.
1.3. ', , ' . ' New Dispose. , ' TPerson
Var
Person:^TPerson;
Begin
New (Person);
...
Dispose (Person);
End.
' , ' Constructor
Person^.Init;
' '
New (Person, Init);
' ' Destructor (), . ' Done - . Destructor
Destructor Done; Virtual;
Destructor TPerson.Done;
Begin
End.
' '
Dispose (Person, Done);
1.4. ', ' , ' , .
1.5. 1. ' , W G W=G*100-100, ᒺ Ƴ Ww=W*0,85 Wm=W*0,9 .
Program Weight_OOP;
Uses Crt;
{ ᒺ }
Type TPerson=object
Name:string [15];
Growth:real;
Constructor Init;
Destructor Done; Virtual;
Procedure Read_Date;
Procedure Write_Date;
Function Weight:real; Virtual;
end;
Constructor TPerson.Init;
begin
Name:= ' ';
Growth:= 0.0;
end;
Destructor TPerson.Done;
begin
end;
Procedure TPerson.Read_Date;
begin
Write (' "? ');
|
|
Readln (Name);
Write (' в, ? ');
Readln (Growth);
end;
Procedure TPerson.Write_Date;
begin
ClrScr;
Writeln (' ": ',Name);
Writeln (' : ',Weight:5:1,' ');
end;
Function TPerson.Weight:real;
begin
Weight:=Growth*100-100;
end;
{ ᒺ Ƴ}
Type TWoman= object (TPerson)
Function Weight:real; Virtual;
end;
Function TWoman.Weight:real;
begin
Weight:=TPerson.Weight*0.85;
end;
{ ᒺ }
Type TMan= object (TPerson)
Function Weight:real; Virtual;
end;
Function Tman.Weight:real;
begin
Weight:=TPerson.Weight*0.9;
end;
Var
Woman:^TWoman;
Man:^TMan;
Ch:char;
Begin
TextColor (yellow);
TextBackGround (lightgray);
ClrScr;
New (Woman,Init);
New (Man,Init);
{ }
Write (' (/)? ');
Repeat
Ch:=ReadKey;
Until (Ch='') or (Ch='') or (Ch='') or (CH='');
Writeln;
{ }
If (Ch='') or (Ch='') then
with Woman^ do
begin
Read_Date;
TextColor (red);
Write_Date;
end
else
with Man^ do
begin
Read_Date;
TextColor (blue);
Write_Date;
end;
Dispose (Woman, Done);
Dispose (Man, Done);
Readln;
End.
2.
"", .
2.1. ', y=*s(D*), ' y1=*s(D*)+*sin(C*) y2=*s(D*)*(+2) 10 0,1. .
2.2. ', =*(1--t/T1), ' y1=*(1--t/T1)+*s(D*t) y2=*(1--t/T1)*sin(K*t) t 8 0,05. .
2.3. ', y=-K*z, ' y1=(-K*z)+*s(z) y2=(-K*z)-*(1--z) Z 20 0,5. .
2.4. ', y=*sin(B*), ' y1=*sin(B*)-*s(2*) y2=*sin(B*)-D*2 16 0,2. .
2.5. ', y=D*-t/T, ' y1=D*-t/T+s(C*t) y2=D*-t/T-s(A*t) t 12 0,06. .
2.6. ', y=A*z, ' y1=A*z+*s(z) y2=A*z-D*(1--z) Z 10 0,02. .
2.7. ', y=*s(z), ' y1=*s(z)*sin(C*z) y2=*s(z)+*z Z 17 0,1. .
|
|
2.8. ', y=*(1--t), ' y1=*(1--t)*s(D*t) y=*(1--t)+s(C*t) t 13 0,1. .
2.9. ', y=K*z+, ' y1=(K*z+)+s(B*z) y2=(K*z+)-*-z Z 4 0,01. .
2.10. ', y=*sin(B*+1), ' y1=*sin(B*+1)- y2=*sin(B*+1)-(2+) 8 0,04. .
3. Ͳ
3.1. ᒺ- .
3.2. ᒺ- '.
3.3. '.
3.4. .
3.5. .
3.6. .
3.7. ' '.
3.8. ' ' .
3.9. .
10
² ² ² C
Ѳ.
1. Ͳ Ͳ ²Ҳ
1.1. - stdio.h. ³ #include:
#include <stdio.h>
- getchar() putchar(). c=getchar(); . putchar(c); .
1.2. printf . :
printf( ,1,2,...);
ᒺ :
- , ;
- , ;
- ( , , .).
% , . ̳ :
- -, , . - ;
- , . , , float double;
- l, long;
():
d - ;
o - ;
x - ;
c - ( char);
s - (string);
e - ;
f - (float);
g - e f, ;
u - (unsigned);
p - (pointer).
% , .
:
\a - (alarm);
\b - (back);
\n - (new);
\r - ( ) (return);
\t - (tabulation);
\v - (vertical).
printf:
printf(\t\n%d\n,i);
: ( \t), "" (\n). %d . ϳ (\n).
printf(\ti=%ld;\nj=%d.\n,i,j);
: (\t), "=", %ld , ;, (\n), j=, %d j , , .
|
|
1.3. scanf . stdio.h.
:
scanf( ,1,2,...);
printf. % *, .
scanf printf ( &).
scanf:
scanf(%d %f %c %s,&i,&j,&k,l);
: , , , j , k , l . l & , l[20], l .
scanf(%d %*d %d, &i,&j);
5 7 9 i 5, j - 9, 7 ( * %).
scanf(%d,%d,&n,&m);
.
1. , .
#include <stdio.h>
main()
{
int a;
char b;
float c;
double d;
short x;
long y;
unsigned z;
scanf("%d %c %f %lf %d %ld %u",&a,&b,&c,&d,&x,&y,&z);
printf("%d %c %9.5f %19.11f\n %d %ld %u",a,b,c,d,x,y,z);
}
9.5 c float , 9 , 5 . 19.11 d double.
2. , f, e, g.
#include <stdio.h>
main()
{
char s[30];/* 30 */
float a=86.531;
printf("%s\n","Electrical Drive Department");
/* */
printf("Input String\n");
scanf("%s",s);
/* */
printf("(20s):%20s\n",s);
/* , 20- */
printf("(-20s):%-20s\n",s);
/* , 1- */
printf("(20.10s):%20.10s\n",s);
/* , */
/* 20- */
printf("(-20.10s):%-20.10s\n",s);
/* , */
/* 1- */
printf("(.10s):%.10s\n",s);
/* 10 10 */
/* */
printf("%%\n");
/* %*/
printf("a=%e\n",a);
printf("a=%f\n",a);
printf("a=%g\n",a);
/* */
}
3. , , , , , .
#include <stdio.h>
main()
{
int a,b;
char c[50],d,f;
printf("Input 3 integer and string\n");
/* 3 */
scanf("%d %*d %d %s",&a,&b,c);
/* */
printf("a=%d; b=%d; c=%s\n",a,b,c);
printf("Input integer and symbol without space\n");
/* */
scanf("%d%c",&a,&d);
printf("a=%d; d=%c\n",a,d);
printf("Input 2 unteger devided by comma\n");
/* 2 , */
scanf("%d,%d",&a,&b);
printf("a=%d; b=%d\n",a,b);
printf("Input string\n");
/* */
scanf("%3s\n",c);
/* 3 */
printf("c=%s",c);
}
1.4. , , puts() gets() , :
puts ("Electric drive");
gets (vstring);
4. gets gets puts.
#include <stdio.h>
main()
{
char q[40];
puts("Input string");
/* */
gets(q);
/* */
puts(q);
/* */
}
2.
Ѳ, .
2.1. a b, , . d=(a2+b2)/(c-b), a, b, c, d : 10 ; 3 , , .