Help at making a tree trunk

Hello to all
I am a beginner is pascal and i am trying to make a tree trunk that grows acording to the rest of the tree.
I already made the tree itself (here it is):

program Isosceles;
Uses Crt;
var num_lines, line:Integer;
procedure printline (num_esp, num_ast:Integer);
const aster='*';
esp=' ';
var counter:Integer;
begin
for counter:=1 to num_esp do
write(esp);
for counter:=1 to num_ast do
write(aster);
writeln
end;
begin (*Main program*)
writeln ('Height of the tree= ');
readln(num_lines);
for line:=1 to num_lines do
printline(num_lines-line,2*line-1);
readln;
end.


But now i am stuck and cant figure out how to make the tree trunk

I <------This part i want it to grow as the tree gets bigger(this part needs to be added at the bottom of the tree).



Help would be much appreciated

ps:I am usig Dev-Pascal 1.9.2.

Comments

  • quikcarlxquikcarlx Hollywood, Fl
    I altered your program so that your subroutine could be a little more flexible. I dont know how you wanted to do the trunk so I made some assumptions.
    [code]program Isosceles;

    Uses Crt;

    var
    num_lines, line : Integer;
    trnk_spcs : integer;

    procedure printline ( num_esp, num_ast : Integer; tt : char );

    const
    esp = ' ';

    var
    counter : Integer;

    begin

    for counter := 1 to num_esp do
    write( esp );

    for counter := 1 to num_ast do
    write( tt );

    writeln
    end;

    begin (* Main program *)
    writeln( 'Height of the tree= ' );
    readln( num_lines );

    for line := 1 to num_lines do
    printline( num_lines - line, 2 * line - 1, '*' );

    trnk_spcs := num_lines - 1;

    for line := 1 to 4 do
    printline( trnk_spcs, 2, '|' );

    readln
    end.
    [/code]
  • Sorry but on my initial post i didnt explain myself to well, my bad.
    quikcarlx i want the tree trunk to grow as the tree gets bigger i have made some progress:

    program Isosceles;
    Uses Crt;
    var num_lines, line, temp:Integer;
    procedure printline (num_space, num_ast:Integer);
    const aster='*';
    esp=' ';
    var counter:Integer;
    begin
    for counter:=1 to num_space do
    write(esp);
    for counter:=1 to num_ast do
    write(aster);
    writeln
    end;
    Procedure trunk1;
    const esp=' ';
    trunk='I';
    Var counter:Integer;
    begin
    for counter:=1 to num_lines-1 do
    write(esp);
    writeln(trunk);
    end;
    begin (*main program*)
    writeln ('Height of the tree= ');
    readln(num_lines);
    for line:=1 to num_lines do
    printline(num_lines-line,2*line-1);
    for temp:=1 to num_lines do
    trunk1;
    readln;

    end.


    But i still havent figured out how to make the tree trunk get thicker as the tree gets bigger.

    Sorry taking so long to reply
  • quickcartx could you please contact me regarding a pascal bug I need help with? dennis dot lamb at gmail
  • quickcartx could you please contact me regarding a pascal bug I need help with? dennis dot lamb at gmail
  • quikcartx could you please contact me regarding a bug in a piece of Pascal code I am experiencing? dennis dot lamb at gmail
Sign In or Register to comment.

Howdy, Stranger!

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

Categories