Вот код:
Код
uses Crt, Graph;
var Drv, Md, x0, x: integer; c, w, t, m1: real; cs, ws: string; q: char;
function vvod(xnps: integer; ynps: integer; b:integer): real;
var j: string; a: real; Code: integer;
begin
repeat
gotoxy(xnps,ynps);
writeln(' ');
gotoxy(1,ynps+1);
writeln(' ');
gotoxy(xnps,ynps);
readln(j);
val(j,a,Code);
if Code <> 0 then begin Writeln('Вводите цифры!'); readkey end;
until (a <= b)and(a > 0);
vvod := a
end;
begin
clrscr;
gotoxy(1,4); write('Введите C => '); c := vvod(15, 4, 640);
gotoxy(1,6); write('Введите w => '); w := vvod(15, 6, 640);
DetectGraph(Drv, Md);
InitGraph(Drv, Md, 'c:\bp\bgi');
m1 := GetMaxX/c;
OutTextxy(1,3,'Ghange w - key arrowUp and arrowDn.');
str(Round(c),cs);
OutTextxy(1,20,'C = '); OutTextxy(40,20,cs);
OutTextxy(80,20,'w = ');
OutTextxy(10,450,'For EXIT press Esc.');
x0 := round((GetMaxX-c)/2);
t := 0;
repeat
q := #0;
str(Round(w),ws);
SetColor(11);
OutTextxy(120,20,ws);
if keypressed then
begin
SetColor(0);
OutTextxy(120,20,ws);
q := readkey;
case q of
#080: w := w*0.9;
#072: w := w*1.1;
end;
str(Round(w),ws);
SetColor(11);
OutTextxy(120,20,ws);
end;
x0 := round((GetMaxX-c)/2);
SetColor(9);
line(0, 200,GetMaxX, 200);
x := Round(C*m1*(1+cos(w*t))/2);
PutPixel(x,220, white);
Delay(9000);
SetColor(0); line(0, 220,GetMaxX, 220);
t := t + 2*pi/500;
until q = #27;
CloseGraph;
end.
Единственное, что надо - изобразить вдоль какого-то отрезка С. А я пока могу только вдоль экрана, слева-направа. Подскажите, что надо добавить.