uses crt,graph;
var
 a,w,f,t:real;
 a1,w1,f1:real;
procedure init;
var gd,gm:integer;
begin
  gd:=detect;gm:=0;
  initgraph(gd,gm,'c:\limbaje\tp\bgi');
  if graphresult<>grOk then halt(1);
end;
procedure citire;
begin
 write('Introduceti  amplitudinea,a1=');readln(a);
 write('Introduceti  viteza unghiulara,w1=');readln(w);
 write('Introduceti  faza initiala,fi1=');readln(f);
 write('Introduceti  amplitudinea pentru oscilatia 2,a2=');readln(a1);
 write('Introduceti  viteza unghiulara pentru oscilatia 2,w2=');readln(w1);
 write('Introduceti  faza initiala pentru oscilatia 2,fi2=');readln(f1);
end;
procedure oscil(aa,ww,ff,pas1:real;cul:integer);
var
 y:real;
begin
 t:=0;
 repeat
  y:=aa*sin(ww*t+ff+pi);
  putpixel(round(t),round(y+240),cul);
  t:=t+pas1;
 until t>600;
end;
procedure oscp(aa,aaa,www,ww,fff,ff,pas1:real;cul:integer);
var yt:real;
begin
  t:=0;
  repeat
   yt:=aa*sin(ww*t+ff+pi)+aaa*sin(www*t+fff+pi);;
   putpixel(round(t),round(yt+240),cul);
   t:=t+pas1;
  until t>600;
end;
 begin
  citire;
  init;
  setbkcolor(11);
  oscil(a,w,f,0.01,12);
  oscil(a1,w1,f1,0.01,4);
  readln;
  cleardevice;
  oscp(a,a1,w,w1,f,f1,0.01,5);
  readln;
  closegraph;
 end.