Uses Graph; Type TDigit = Array[0 .. 9, 1 .. 9] Of Byte; Const DX = 20; DY = 30; Digits: TDigit = ( (1, 1, 1, 1, 1, 1, 0, 0, 0), (0, 0, 1, 1, 0, 0, 0, 0, 0), (0, 1, 1, 0, 1, 1, 0, 1, 0), (0, 1, 0, 0, 0, 0, 1, 1, 1), (1, 0, 1, 1, 0, 0, 0, 1, 0), (1, 1, 0, 1, 1, 0, 0, 1, 0), (0, 0, 0, 1, 1, 1, 1, 1, 0), (0, 1, 0, 0, 0, 1, 1, 0, 0), (1, 1, 1, 1, 1, 1, 0, 1, 0), (1, 1, 1, 0, 0, 0, 0, 1, 1)); var n: string[6]; Procedure ShowDigit(xStart, yStart: Word; Digit: Byte); var i: integer; Begin for i := 1 to 9 do begin if Digits[Digit, i] = 1 then setcolor(LightRed) Else SetColor(Red); Case i of 1: Line(xStart, yStart, xStart, yStart+DY); 2: Line(xStart, yStart, XStart+DX, yStart); 3: Line(xStart+DX, yStart, xStart+DX, yStart+DY); 4: Line(xStart+DX, yStart+DY, xStart+DX, yStart+2*DY); 5: Line(xStart+DX, yStart+2*DY, xStart, yStart+2*DY); 6: Line(xStart, yStart+2*DY, xStart, yStart+DY); 7: Line(xStart+DX, yStart, xStart, yStart+DY); 8: Line(xStart, yStart+DY, xStart+DX, yStart+DY); 9: Line(xStart+DX, yStart+DY, xStart, yStart+2*DY); end; end; End; Procedure ShowOne(xStart, yStart: Word); Begin ShowDigit(xStart, yStart, 1) End; Procedure ShowTwo(xStart, yStart: Word); Begin ShowDigit(xStart, yStart, 2) End; Procedure ShowThree(xStart, yStart: Word); Begin ShowDigit(xStart, yStart, 3) End; Procedure ShowFour(xStart, yStart: Word); Begin ShowDigit(xStart, yStart, 4) End; Procedure ShowFive(xStart, yStart: Word); Begin ShowDigit(xStart, yStart, 5) End; Procedure ShowSix(xStart, yStart: Word); Begin ShowDigit(xStart, yStart, 6) End; Procedure ShowSeven(xStart, yStart: Word); Begin ShowDigit(xStart, yStart, 7) End; Procedure ShowEight(xStart, yStart: Word); Begin ShowDigit(xStart, yStart, 8) End; Procedure ShowNine(xStart, yStart: Word); Begin ShowDigit(xStart, yStart, 9) End; Procedure ShowZero(xStart, yStart: Word); Begin ShowDigit(xStart, yStart, 0) End; var gdriver, gmode, ErrCode: Integer; i: byte; xs, ys: word; begin write('index = '); readln(n); { n := '1234567890'; } xs := 100; ys := 100; initgraph(gdriver, gmode, ''); if graphresult <> grOk then begin writeln('Graph error: ', grapherrormsg(ErrCode)); ReadLn; Halt(100); end; for i := 1 to length(n) do begin Case Ord(n[i])-Ord('0') Of 0: ShowZero(xs, ys); 1: ShowOne(xs, ys); 2: ShowTwo(xs, ys); 3: ShowThree(xs, ys); 4: ShowFour(xs, ys); 5: ShowFive(xs, ys); 6: ShowSix(xs, ys); 7: ShowSeven(xs, ys); 8: ShowEight(xs, ys); 9: ShowNine(xs, ys); End; inc(xs, DX+10); end; readln; closegraph; end.