Forum > Beginners

pascal assignment

(1/5) > >>

user4592357:
i'd really appreciate if someone helped me with this. pretty new to pascal graphics, don't know what's wrong..

thanks in advance..


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---uses crt,graph;const xmax=640;ymax=480; type mat=array[0..10,0..10] of integer;     vec=array[0..10] of integer; var f:file of integer;zr,n:byte;m,t,k:integer;c:char;    zx0,zx1,zy0,zy1:real;y: array[0..2] of real;    graphdriver,graphmode:integer;    j,i:integer; l,Q:byte;    x:mat;        z,d:vec; function baz (a,b:integer): boolean;beginif (a mod b=2) and (a>0) thenbaz:=trueelsebaz:=falseend; {===============MENU=====================}procedure menu(c1,c2,c3,c4:byte);begin {cleardevice;}  setbkcolor(0); {==MeC==}  Line(324,12,560,120); line(560,120,560,350); line(560,350,324,458); Line(324,458,90,350); line(90,350,90,120); line(90,120,324,12); setfillstyle(14,5);    {===4 hat ==}setcolor(4); line(320,20,320,226); line(320,226,100,128); line(100,128,320,20); setfillstyle(1,4); setcolor(4); line(328,20,328,226); line(328,226,552,128); line(552,128,328,20);setfillstyle(1,4);  line(328,236,328,450); line(328,450,552,342); line(552,342,328,236);  setfillstyle(1,4);   setcolor(4); line(320,234,320,450); line(320,450,100,342); line(100,342,320,234); setfillstyle(1,4);   {====2 poqr===}  setcolor(15); line(124,180,268,230); line(268,230,124,278); line(124,278,124,180); setfillstyle(1,15);  setcolor(15); line(526,180,526,278); line(526,278,380,230); line(380,230,526,180); setfillstyle(1,15);      {---------------}  settextstyle(6,0,4); setcolor(c1);outtextxy(210,130,'Pahanj');setcolor(c2);outtextxy(360,130,'Lucum');setcolor(c3);outtextxy(170,340,'Animation');setcolor(c4);outtextxy(360,340,'Avart');end; {-------------Pahanj----------------} procedure pahanj;begin cleardevice;settextstyle(3,0,5);setcolor(15);outtextxy(120,50,'Trvac en n amboghj...');{-----------------------------------}readkey end;{------------------------------------------------------------------------------} {----------------Lucum------------}{==procedure lucum;begin==} procedure vector (n2:integer;x2:vec);beginfor i:=1 to n2 doreadln(x2[i]);end;beginrepeat write ('m='); readln (m)until (m>1) and (m<=10);for i:=1 to m do vector (m,z);for j:=1 to m do x[i,j] := z [j];l:=0;for i:=1 to m dofor j:=1 to m do if baz (x[i,j],5)= true then l:=l+1; write('l=',l); end.   cleardevice;settextstyle(3,0,5);setcolor(15);outtextxy(120,50,'Xndri Lucum@');  readkey; end; procedure animation; var   X, Y:array [1..400] of integer;   i, Gx, Gy, Gy1, Gd, Gm: integer;   z:byte;BEGIN     Gd:=Detect;     InitGraph(Gd, Gm, 'X:\BP');     randomize;     Gx:=GetMaxX;     Gy:=GetMaxY;     SetColor(15);    for i:=1 to 200 do                begin                     X[i]:= random(Gx);                     Y[i]:= random(Gy div 1);                     PutPixel(X[i],Y[i],15)                end;               repeat                inc (z);                for i:=1 to 200 do                        begin                             if (Y[i] < Gy) and (GetPixel(X[i],Y[i]+1)= 0)                                then                                        begin                                             PutPixel(X[i], Y[i],0);                                             Y[i]:= Y[i]+1;                                             PutPixel(X[i], Y[i],15)                                        end                                else                                        begin               if Y[i] < 20 then               begin                 PutPixel(X[i], Y[i],0);               end else               begin                  Line(X[i] - 3, Y[i] - 2, X[i] + 3, Y[i] + 2);                  Line(X[i] + 3, Y[i] - 2, X[i] - 3, Y[i] + 2);                  Line(X[i], Y[i] - 3, X[i], Y[i] + 3);               end;                                              Y[i]:={random(Gy div 40)}0;                                             X[i]:= random(Gx);               PutPixel(X[i], Y[i], 15);          end;       end;          settextstyle(7,0,7);          outtextxy(60,150,'HAPPY ');          outtextxy(300,250,'NEW');          outtextxy(500,350,'YEAR');          settextstyle(7,0,6);          outtextxy(60,470,'Thanks For Watching');     until keypressed;    readkey; END; begininitgraph(m,t,'');  repeat k:=1;  cleardevice;repeat case k of1:menu(15,4,4,4);2:menu(4,15,4,4);3:menu(4,4,15,4);4:menu(4,4,4,15);end;c:=readkey; if ord(C)=80 then k:=k-1;if ord(C)=72 then k:=k+1;if k=0 then k:=4;if k=5 then k:=1;until ord(c)=13; case k of1:pahanj;2:lucum;3:animation;end;until k=4; end.

eny:

--- Quote from: gainnew on April 21, 2016, 09:14:50 pm ---i'd really appreciate if someone helped me with this. pretty new to pascal graphics, don't know what's wrong..
--- End quote ---
The question is missing.

Bart:
Not related to the question (if any), but useing both crt and graph unit is not recommended in fpc.

Bart

user4592357:
Thequestion is that I don't understand why doesn't this code work fully???
Actually I can input the number of vector elements and the elements too, but then some things shoukdnbe printed on the screen but they won't ... And I don't know why



So whixh one to usr?  Graph.or CRT?

Handoko:
Please provide more information. Like what is the error message, what is the result you expect and what is the output or it's better if you can provide screenshots. We can't guess what you want.

Navigation

[0] Message Index

[#] Next page

Go to full version