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
[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]
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