Pascal: Pupil Records

program pupil_records;
type pupil_record = record
          name : string;
          form : string;
          year_of_entry: integer;
        end;

var  pupil : pupil_record;

procedure get_data;
begin
  with pupil do
   begin
    writeln ('Enter name:');
    readln (name);
    writeln ('Enter form:');
    readln (form);
    writeln ('Enter year of entry:');
    readln (year_of_entry);
   end;
end;

procedure show_data;
begin
  with pupil do
  writeln ('You entered:', name, ' ', form, ' ', year_of_entry);
end;

begin
  writeln ('Enter details of a pupil, name, form and year of entry');
  get_data;
  show_data;
  readln;
end.

 

Back to questions