Đăng Nhập

Vui lòng khai báo chính xác tên truy cập và mật khẩu!

Quên mật khẩu?

    Bài tập kiểu tệp(tập tin)

      Admin
      Admin

      Giới tính : Nam

      Đến từ : TPHCM

      Ngày Tham gia : 03/04/2011

      Tổng số bài gửi : 2292

      #1

       Thu Aug 11, 2011 9:29 pm

      Code:
      var tep1,tep2:text;
       i,n:integer;
       th,lt,tb:real;
      begin
       assign(tep1,'E:\a.txt');
       rewrite(tep1);
       write('nhap so luong hoc sinh: ');readln(n);
      for i:=1 to n do
       begin
        writeln('diem hoc sinh thu ',i,':');
        write('diemm li thuyet: ');readln(lt);
        write('diem thuc hanh: '); readln(th);
        write(tep1,lt:6:1,th:6:1);
      end;
      close(tep1);
      assign(tep2,'E:\b.txt');
      rewrite(tep2);reset(tep1);
      i:=1;
      while not eof(tep1) do
       begin
        read(tep1,lt,th);
        tb:=(lt+th*2)/3;
        writeln('diem trung binh hoc sinh thu ',i,': ',tb:6:1);
        writeln(tep2,'diem trung binh hoc sinh thu ',i,': ',tB:6:1);
        i:=i+1;
       end;
      close(tep2);
      writeln('nhan enter de ket thuc');
      readln;
      end.