Mảng thay vì kiểu bản ghi
Yêu cầu: Áp dụng các kiến thức về File, Array... Không sử dụng bản ghi
Uses crt;
Const
max=100;
Var
F:Text;
a:array[1..max] of integer;
ten:array[1..max] of string;
n,i:integer;
BEGIN
Clrscr;
Write('Nhap so hoc sinh:');
Readln(n);
Assign(F,'HOSO.TXT');
Rewrite(F);
For i:=1 to n do
Begin
Writeln('Nhap thong tin ve hoc sinh thu ',i,':');
Write('Nhap ten cua hoc sinh thu ',i,':');
Readln(ten[i]);
Write('Nhap nam vao hoc cua hoc sinh thu ',i,':');
Readln(a[i]);
Writeln;
Writeln(F,'Hoc sinh thu ',i,', ten la:',ten[i],' vao hoc nam:',a[i]);
End;
Close(F);
Writeln('Danh sach cac hoc sinh vao hoc nam 2000:');
For i:=1 to n do
If a[i]=2000 then writeln('Hoc sinh thu ',i,', ten la:',ten[i]);
Write('Done !');
END.
0 nhận xét:
Đăng nhận xét
Click to see the code!
To insert emoticon you must added at least one space before the code.