📄 eg10-3.pas
字号:
program p10_3(input,output,stfile);
const
n=5;
type
student=record
num:integer;
name:string[20];
sex:(male,female);
age:15..35;
score:real;
end;
var
stfile:file of student;
stud:student;
se:char;
i:integer;
begin
assign(stfile,'f10_3');
rewrite(stfile);
writeln('input se,num,age,score,name');
for i:=1 to n do
begin
with stud do
begin
readln(se,num,age,score,name);
if se='f' then sex:=female
else sex:=male;
end;
write(stfile,stud);
end;
reset(stfile);
writeln('num':8,'name':10,'sex':8,'age':8,'score':8);
while not eof(stfile) do
begin
read(stfile,stud);
with stud do
begin
write(num:8,name:10);
if sex=female then write('female':8)
else write('male':8);
writeln(age:8,score:8:1);
end
end;
close(stfile);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -