pcsinhvien

Màu nền
Font chữ
Font size
Chiều cao dòng

program quan_ly_sinh_vien;

  uses crt;

  type sinhvien=record

       masv:string[6];

       tensv:string[30];

       ngaysinh:string[20];

       lop:string[10];

       diemtoan:real;

       end;

  var f:file of sinhvien;

      temp:sinhvien;

      chon:integer;

procedure taotep;

var lap:char;

      begin

      assign (f,'sinhvien.dat');

      rewrite(f);

      repeat

        with temp do

      begin

        write('nhap ma sinh vien:');readln(masv);

        write('nhap ten sinh viwn:');readln(tensv);

        write('nhap ngay sinh:');readln(ngaysinh);

        write('nhap lop:');readln(lop);

        write('nhap diem toan:');readln(diemtoan);

          end;

        write(f,temp);

      writeln('ban muon nhap tiep hay khong (c/k)?');readln(lap);

        until upcase(lap)='K';

close(f);

end;

procedure doctep;

      begin

       assign(f,'sinhvien.dat');

       reset(f);

       writeln('danh sach sinh vien duoc nhap la');

       while not eof(f) do

      begin

        read(f,temp);

        with temp do

        writeln(masv,' ',tensv,' ',ngaysinh,' ',lop,' ',diemtoan);

      end;

       close(f);

  end;

procedure danhsach;

         begin

           assign(f,'sinhvien.dat');

           reset(f);

            writeln('danh sach sinh vien thuoc lopa la');

            while not eof(f) do

           begin

             read(f,temp);

             with temp do

              if lop='lopa' then

              writeln(masv,' ',tensv,' ',ngaysinh,' ',lop,' ',diemtoan);

           end;

            close(f);

         end;

procedure xuly;

      begin

       assign(f,'sinhvien.dat');

       reset(f);

        writeln('tim va sua diem sinh vien co ma la 533410 thanh 9');

        begin

         read(f,temp);

         with temp do

         if masv='533410' then

         begin

         write('nhap diem can sua:');readln(diemtoan);

           seek(f,filepos(f)-1);

          write(f,temp);exit;

          end;

          close(f);

          end;

          end;

         begin

         clrscr;

   writeln('    CHUONG TRINH QUAN LY SINH VIEN      ');

   writeln('    nhan pham 1 de tao tep              ');

   writeln('    nhan pham 2 de doc tep              ');

   writeln('    nhan phim 3 de hien danh sach lop   ');

   writeln('    nhan pham 4 de xu ly yeu cau        ');

   writeln('    nhan phim 5 de thoat                ');

     repeat

     writeln('  hay nhan phim    ');

     readln(chon);

     case chon of

     1:taotep;

     2:doctep;

     3:danhsach;

     4:xuly;

     end;

     until chon=5;

     readln;

     end.

Bạn đang đọc truyện trên: Truyen2U.Pro

#thu