Writeln' MAY TINH TAY'; Writeln'Thuc hien 4 phep tinh so hoc';... Writeln' Bam phim de ket thuc';... Procedure QuickSortVar A: Mang; Lo,Hi: Integer; Procedure SortLeft, Right:Integer;..
Trang 1Thư Viện Các Dạng Bài Tập Pascal của Tin Học 11 - Phần 4201/Làm tròn số thực:
Writeln('LAM TRON SO THUC');
Writeln(' Su dung ham');
Writeln(' KET QUA');
Writeln('*So nhap vao = ',so:12:10);
Writeln('*So lam tron = ',Tron(so,le):12:le);
Trang 2Writeln(' MAY TINH TAY');
Writeln('Thuc hien 4 phep tinh so hoc');
Trang 3End;
1 : Begin
Writeln('+Ngay:',ngay:3,',thang:',thang:3,',nam:',luu:5); Writeln('+La ngay Thu Hai');
End;
2 : Begin
Writeln('+Ngay:',ngay:3,',thang:',thang:3,',nam:',luu:5); Writeln(' +La ngay Thu Ba');
End;
3 : Begin
Writeln('+Ngay:',ngay:3,',thang:',thang:3,',nam:',luu:5); Writeln(' +La ngay Thu Tu');
End;
4 : Begin
Writeln('+Ngay:',ngay:3,',thang:',thang:3,',nam:',luu:5); Writeln(' +La ngay Thu Nam');
End;
5 : Begin
Writeln('+Ngay:',ngay:3,',thang:',thang:3,',nam:',luu:5); Writeln(' +La ngay Thu Sau');
End;
6 : Begin
Writeln('+Ngay:',ngay:3,',thang:',thang:3,',nam:',luu:5); Writeln(' +La ngay Thu Bay');
Trang 9Writeln('TIM 10 S0 NGUYEN NGAU NHIEN KHONG AM');
Writeln(' NHO HON 100, KHONG TRUNG NHAU');
Trang 12Writeln('+Chieu dai cua vecto = ',l:10:2);
Writeln(' Bam phim <Enter> de ket thuc');
Trang 13Writeln('+Chu vi hinh chu nhat= ',p);
Writeln('+Dien tich hinh chu nhat= ',s);
Writeln('+Chu vi vong tron = ',cv:10:2);
Writeln('+Dien tich vong tron = ',s:10:2);
Writeln('-So dan hien nay = ',sodan);
Writeln('-Ty le tang dan so hang nam = 1.5%');
Writeln;
Writeln('So dan tang tung nam trong 5 nam toi la:');
For i:=1 To 5 Do
Begin
Trang 14Writeln(' 1-Hinh vuong');
Writeln(' 2-Hinh chu nhat');
Writeln(' 3-Hinh tam gia1c');
Writeln(' 4-Hinh thang');
Writeln(' 5-Hinh tron');
Trang 15Writeln('+Dien tich hinh tron = ',s:10:2,' met vuong');
Writeln('TINH GIAI THUA CUA N');
Writeln(' Su dung ham');
Writeln('KET QUA CHUYEN DOI');
Writeln('+Neu nhap vao: ',sogiay,' giay');
Writeln('+Doi thanh: ',gio,' gio, ',phut,' phut, ',giay,' giay');
Trang 16d:=((a*x) + (b*y) + c) / Sqrt(Sqr(a) + Sqr(b));
Writeln('+Khoang cach tu diem I den duong thang la: ',d:10:2); Readln
Trang 19Matran=array[1 3,1 3] Of Integer; Var
Trang 20237/Trò chơi One Two Three:
Program One_Two_Three;
Var
a,b:Char;
Begin
Writeln('TRO CHOI ONE TWO THREE');
Writeln(' Keo (k), Bua (b), Giay (g)');
Trang 22Writeln(' Bam phim <Enter> de ket thuc');
Trang 24Procedure QuickSort(Var A: Mang; Lo,Hi: Integer);
Procedure Sort(Left, Right:Integer);
Trang 26Writeln(' Thang 11 nam 1999');
First := NIL; {Khoi tao bien First la con tro rong}
Trang 27Writeln('-Ong ba: ',HoLot,' ',Ten);
Writeln('-Bac luong: ',BacLuong:8,' -Phu cap: ',PhuCap : 6); Writeln('+Tien linh : ',Tong:8,' Dong'); First :=Next;
Writeln('-Buoc 1:Khai bao bien con tro p,q');
Writeln(' Vung nho bay gio la: ',MemAvail,' bytes');
Writeln;
Writeln('-Buoc 2:Cap vung nho cho 2 bien dong p,q');
New(p); {Cap phat vung nho cho p^}
New(q); {Cap phat vung nho cho q^}
Writeln(' Vung nho bay gio la: ',MemAvail,' bytes');
Writeln;
Writeln('-Buoc 3:Dien noi dung vao vung nho va thao tac');
p^ := 1;{Dien noi dung vao vung nho cho p^}
q^ := 1;{Dien noi dung vao vung nho cho q^}
p^ := p^ + q^; {Thuc hien bieu thuc chua bien dong}
Writeln('-Khi moi bat dau chuong trinh thi');
Writeln('Vung nho Heap con: ',MemAvail,' bytes trong');
Writeln;
New(p1);
P1^ :=12345;
Writeln('-Noi dung cua bien dong P1 la: ',P1^);
Writeln('-Sau khi cap phat bo nho cho bien dong P1 (kieu Integer)'); Writeln('Vung nho Heap con: ',MemAvail,' bytes trong');
Writeln;
k := Sizeof(p2^);
GetMem(p2,Sizeof(p2^));
Trang 28P2^ :='Nha sach Minh Khai, 249 Nguyen Thi Minh Khai, Q1, Tel 8.331.124'; Writeln('-Noi dung cua bien dong P2 la: ',P2^);
Writeln('-Sau khi cap phat bo nho cho bien dong P2 (kieu String)');
Writeln('Vung nho Heap con: ',MemAvail,' bytes trong');
Writeln;
New(p3);
Writeln('-Sau khi cap phat bo nho cho bien dong P3 (kieu Real)');
Writeln('Vung nho Heap con: ',MemAvail,' bytes trong');
Writeln;
Writeln('+ Bam phim <Enter> de xoa bien P1 bang thu tuc Dispose'); Readln;
Dispose(p1);
Writeln('-Sau khi Xoa cac bien dong P1 (kieu Integer) ');
Writeln('Vung nho Heap bay gio la: ',MemAvail,' bytes trong');
Writeln;
Writeln('+ Bam phim <Enter> de xoa bien P2 bang thu tuc FreeMem'); Readln;
Freemem(p2,k);
Writeln('-Sau khi Xoa cac bien dong P2 (kieu String) ');
Writeln('Vung nho Heap bay gio la: ',MemAvail,' bytes trong');
Writeln;
Writeln('+ Bam phim <Enter> de xoa bien P3 bang thu tuc Dispose'); Readln;
Dispose(p3);
Writeln('-Sau khi Xoa cac bien dong P1 (kieu Integer) ');
Writeln('Vung nho Heap bay gio la: ',MemAvail,' bytes trong');
Writeln('-Khi moi bat dau chuong trinh thi');
Writeln('Vung nho Heap con: ',MemAvail,' bytes trong');
Writeln('-Sau khi cap phat bo nho cho bien dong P2 (kieu String)');
Writeln('Vung nho Heap con: ',MemAvail,' bytes trong');
Writeln;
New(p3);
Writeln('-Sau khi cap phat bo nho cho bien dong P3 (kieu Real)');
Writeln('Vung nho Heap con: ',MemAvail,' bytes trong');
Writeln;
Dispose(p2);
Writeln('-Sau khi Xoa cac bien dong P2 (kieu String) ');
Writeln('Vung nho Heap bay gio la: ',MemAvail,' bytes trong');
Readln
End
248/Thủ tục release:
Trang 29Writeln('-Khi moi bat dau chuong trinh thi');
Writeln('Vung nho Heap con: ',MemAvail,' bytes trong');
Trang 31Procedure Init(dd,mm,yy : Word);
Function StrDate : String;
Trang 32Writeln;
Write(' Xem xong, bam <Enter> '); Readln
END