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.
kazooie21Asked:
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.

kazooie21Author 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
BatalfCommented:
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
BatalfCommented:
If name1 have a size of 13 the
for i:=1 to 20-length(name1) adds
7 <spaces>.

Instead of the code above, you could also use :

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

0
BatalfCommented:
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
BatalfCommented:
See comment
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Pascal

From novice to tech pro — start learning today.