Code:
program nameloop;
uses crt;
var index,count: integer;
name,initial,gender:string;
salary:real;
begin
clrscr;
for index:=1 to 2 do
begin
writeln('enter your first name ');
readln(name);
writeln('enter your initial ');
readln(initial);
writeln('enter your gender ');
readln(gender);
writeln('enter your salary ');
readln(salary);
end;
begin
for count:=1 to 2 do
writeln (name,'ÂÂ', initial, 'ÂÂ', gender, 'ÂÂ' , salary:2:2, 'ÂÂ');
readln (name, initial, gender, salary);
end;
end.
I'm having trouble displaying the desired output with above code. The out put should be headings:
Name Initial Gender Salary
And below this output the results of the data entered. So far I can get the program to accept input data, for it to display, but it only displays the last set of data. For example, if I enter:
Bob S Male 100
Tim P Male 200
Only the last record, Tim P Male 200 appears, and repeats, rather than the two records appearing below one another. I'm also not sure how to get the headings to display correctly, do I use "goto x,y"? Where do I place the headings?
I've tried variations but I can't get it to display anything but the last record.
Thanks in advance for any guidance.