Wed, 18 Jun 1902 08:00:00 GMT
printing an array to screen ?
Need some help ! I am writing a program to convert between number bases. In my convDB (decimal to binary) procedure I am storing the binary digits n converted at each Iteration in an array . I want to print it to screen - how ? ---------------------------------------------------------------- PROCEDURE convDB; {pre: decimal number is read post: binary number printed to screen} TYPE binarry = PACKED ARRAY [0..15] OF INTEGER; VAR input , n : INTEGER; element : binarry; BEGIN WRITE ('Enter the decimal to be converted : '); READLN (input); IF (input < 1) OR (input > 32767) THEN errormsg ELSE n := 15; WHILE input > 1 DO BEGIN element[n] := input MOD 2; input := input DIV 2; n := n - 1; END{WHILE}; element[n] := input; WRITE ('Equals to : ',element[0..15]); END{convDB}; -------------------------------------------------------------- Thanks a lot, I already spent a week on that problem - I know the solution is close, but I don't get my mistake . I want to print the whole array at once , NOT through a loop. Is there any part of my code that can be improved for performance , stability etc.. (I am just a student at highschool) Mike
|