Bài tập 11 trang 80 SGK Tin học 11

Lý thuyết Bài tập
Câu hỏi:

Bài tập 11 trang 80 SGK Tin học 11

Hãy bổ sung thêm chương trình Xep_loai (ở §13) những lệnh cần thiết để chương trình đưa ra danh sách học sinh xếp loại A.

Cài đặt chương trình:

program bai11;

uses crt;

const max=60;

type Hocsinh = record

hoten:string[30];

ngaysinh:string[10];

diachi:string[50];

toan, van:real;

xeploai:char;

end;

var lop:array[1..max] of hocsinh;

     N, i:byte;

begin

clrscr;

write('Nhap so luong hoc sinh: ');readln(n);

for i:=1 to n do

with lop[i] do {Chú ý câu lệnh này}

begin

writeln('Nhap so lieu hoc sinh thu ',i,':');

write('Ho va ten: ');readln(hoten);

write('Ngay sinh: ');readln(ngaysinh);

write('Dia chi : ');readln(diachi);

write('Diem toan: ');readln(toan);

write('Diem van : ');readln(van);

if toan+van>=18 then xeploai:='A';

if (toan+van>=14) and (toan+van<18) then xeploai:='B';

if (toan+van>=10) and (toan+van<14) then xeploai:='C';

if (toan+van<10) then xeploai:='D';

end;

clrscr;

writeln('Danh sach hoc sinh:');

for i:=1 to n do

with lop[i] do

writeln(hoten:30,'- xep loai: ',xeploai);

writeln('Danh sach hoc sinh loai A:');

for i:=1 to n do

with lop[i] do

if xeploai='A' then

writeln(hoten:30);

readln

end.

 

-- Mod Tin Học 11

Copyright © 2021 HOCTAP247