#include #include #include #define x getmaxx() #define y getmaxy() #define N 20 void DrawGraph(int kol,float mas1[],float mas2[]) { int driver,mode,rez,i,lenx,leny,grx,gry,depth,points1[14],points2[14]; float max,kx,ky; char st[20]; clrscr(); driver=9; mode=2; initgraph(&driver,&mode,""); rez=graphresult(); if(rez!=grOk) { printf ("Oshibka inicializacii grafiki"); getch(); return; } grx=x/13; gry=y*11/12; setcolor(15); settextstyle(8,0,1); settextjustify(1,2); outtextxy(x/2,5,"2 Diagrammy"); setcolor(2); line(grx,y-gry,grx,gry); line(grx,y-gry,floor(grx*1.1+0.5),floor((y-gry)*1.3+0.5)); line(grx,y-gry,floor(grx*0.9+0.5),floor((y-gry)*1.3+0.5)); line(grx,gry,x-grx,gry); line(x-grx,gry,floor(x-grx*1.3+0.5),floor(gry*1.01+0.5)); line(x-grx,gry,floor(x-grx*1.3+0.5),floor(gry*0.99+0.5)); lenx=x*10/13; leny=y*3/4; max=mas1[0]; for(i=0;imax) max=mas1[i]; if(mas2[i]>max) max=mas2[i]; } ky=max/(float)leny; kx=lenx/(4.0*kol); depth=floor(kx/1.5+0.5); settextstyle(0,0,1); settextjustify(2,1); for(i=1;i<=10;i++) { line(floor(grx*0.9+0.5),gry-(leny*i/10),floor(grx*1.1+0.5),gry-(leny*i/10)); line(grx,gry-(leny*i/10),grx+depth*2,gry-(leny*i/10)-floor(depth*1.65+0.5)); line(grx+depth*2,gry-(leny*i/10)-floor(depth*1.65+0.5),grx+depth*2+lenx,gry-(leny*i/10)-floor(depth*1.65+0.5)); sprintf(st,"%.2f",max*i/10.); setcolor(15); outtextxy(floor(grx*0.9+0.5),gry-(leny*i/10),st); setcolor(2); } line(grx,gry,grx+depth*2,gry-floor(depth*1.65+0.5)); line(grx+depth*2,gry-floor(depth*1.65+0.5),grx+depth*2+lenx,gry-floor(depth*1.65+0.5)); for(i=0;i