Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

print a large letter

Nor ArishamNor Arisham Posts: 20Member
[b][red]This message was edited by Nor Arisham at 2004-10-1 0:8:25[/red][/b][hr]
I want to print a large letter when a user input a letter (in text mode).
Is there anyway i can do this ?
i.e.

user input letter A
the output will be :-

_____A
____A_A
___AAAAA
__A_____A
_A_______A

user input letter AF

_____A_________FFFFF
____A_A________FF
___AAAAA______ FFFF
__A_____A _____ FF
_A_______A_____FF

note : the line (____) no need to appear
(just to make sure a correct view in this post)
p.s. just like in Unix
p.s.s. larger if possible

many thanxs..

Comments

  • zibadianzibadian Posts: 6,349Member
    : I want to print a large letter when a user input a letter (in text mode).
    : i.e.
    :
    : user input letter A
    : the output will be :-
    :
    : A
    : A A
    : AAAAA
    : A A
    : A A
    :
    : user input letter AF
    :
    : A FFFFFF
    : A A FF
    : AAAAA FFFF
    : A A FF
    : A A FF
    :
    : p.s. just like in Unix
    : p.s.s. larger if possible
    :
    : many thanxs..
    :
    I would suggest that you create an array like this:
    [code]
    type
    TLetters: array['A'..'Z', 0..7, 0..7] of char;
    [/code]
    This 3D-array can hold the images of the individual letters (the example is 8x8 "pixels". The code to show the letter is quite simple: a double for-do loop, which places the individual "pixels" on the screen. By looping that through the entire user-inputted string, you can enlarge the user's text. The size can be easily adjusted by changing the last 2 dimensions.
  • Nor ArishamNor Arisham Posts: 20Member
    thanxs..but i'm still couldn't get what do you mean..can u show me a simple program ?

  • zibadianzibadian Posts: 6,349Member
    : thanxs..but i'm still couldn't get what do you mean..can u show me a simple program ?
    :
    :
    Here is a small example, which uses 2x2 Letters and only supports the letters A and B. By expanding the array you can make larger letters and include more letters.
    [code]
    const
    Letters: array['A'..'B', 0..1, 0..1] of char = ((
    ('A','A'),
    ('A','A')
    ),(
    ('B','B'),
    ('B','B')
    ));

    procedure VertShowLetters(s: string);
    { Show s vertically in large letters }
    var
    i, x, y: integer;
    begin
    for i := 1 to Length(s) do
    begin
    for y := 0 to 1 do
    begin
    for x := 0 to 1 do
    write(Letters[s[i], y, x]);
    writeln;
    end;
    writeln;
    end;
    end;

    procedure HorizShowLetters(s: string);
    { Show s horizonally in large letters }
    var
    i, x, y: integer;
    begin
    for y := 0 to 1 do
    begin
    for i := 1 to Length(s) do
    begin
    for x := 0 to 1 do
    write(Letters[s[i], y, x]);
    write(' ');
    end;
    writeln;
    end;
    end;

    begin
    VertShowLetters('ABA');
    HorizShowLetters('ABA');
    Readln;
    end.
    [/code]
    You can get better control by using GotoXY(). The help files contain more info on that function.
  • Nor ArishamNor Arisham Posts: 20Member
    thanxs for help. ;)
Sign In or Register to comment.