code for another table

name1 = Mark, name2 = Herman, name3 = Claudia; wt1 = 153, wt2 = 87, wt3= 136; age1 = 21, age2 = 9, age3 = 20 This all needs to go into a table like this:

Name      Weight    Age
Mark         153      21
Herman        87       9
Claudia      136      20

I've done this so far:

program Table;
var name1, name2, name3,: string
wt1, wt2, wt3:integer
age1, age2, age3: integer

begin
writeln('Name', 'Weight', 'Age':10);
writeln(name1:4, wt1:10, age1:10);
writeln(name2:4, wt2:10, age2:10);
writeln(name3:4, wt3:10, age3:10);

I know you do something like subtracting how many letters in the word from 10, right? The book only gives two columned tables.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Author Commented:
the number in the weight column should be right-aligned under the 't', the numbers in the age column should be right-aligned under the 'e' and the names in the name column should be left-aligned under the 'n' I hope that made some sense!
0
Commented:
program Table;
var name1, name2, name3,: string
wt1, wt2, wt3:integer
age1, age2, age3: integer

begin
write(name1);
for i:=1 to 20-length(name1) do
write(' ');
write(wt1);
for i:=1 to 10-length(wt1) do
write(' ');
write(age1);
(* Do like this for all of the names
If you have an array it could be easier to do this*)

end;

0
Commented:
If name1 have a size of 13 the
7 <spaces>.

Instead of the code above, you could also use :

for i:=1 to 20-length(name1) do
name1:=name1+' ';

0
Commented:
Some corrections :

program Table;
var name1, name2, name3,: string
wt1, wt2, wt3:integer
age1, age2, age3: integer ;
tempstring : string;

begin
write(name1);
for i:=1 to 20-length(name1) do
write(' ');
str(wt1,tempstring);
for i:=1 to 3-length(tempstring) do
write(' ');
write(wt1);
for i:=1 to 10-length(wt1) do
write(' ');
str(age1,tempstring);
for i:=1 to 3-length(tempstring) do
write(' ');
write(age1);

end;

0
Commented:
See comment
0

Experts Exchange Solution brought to you by