Actually a lot of material that must be studied to learn programming Turbo Pascal, but we are not all material can be useful for now, the author will teach about the technique of if then else the most widely used and popular because this technique is really needed for many cases.
The first time you install Turbo Pacal, the DOS version can also be the Windows version, but remember that for DOS Pascal Turbo version you need a patch if your computer is above 200Mhz for example Pentium II — 233Mhz, if you want a little trouble you can, just reduce your computer speed through BIOS then you can run Turbo Pascal, hehe, I suggest it is better to use Turbo Pacal for Windows, because we don’t have to bother searching for patches or reducing computer speed, oh yeah almost forgot if the Windows version uses Uses WinCrt. So if we are in the version DOS uses Uses Crt.
Now we will discuss Turbo Pascal for Windows. After Installing Turbo Pascal for Windows, select Start, then Programs, then TPW 1.5, then click TPW 1.5, then the display appears Turbo Pascal for Windows, then we select New then type below:
uses WinCrt; var c: string;
begin clrscr; repeat
writeln (‘Group list program made by Yogya Family Code’); writeln (‘’);
writeln (‘1. List of fruit groups’); writeln (‘2. List of animal groups’); writeln (‘3. List of city groups’); writeln (‘4. Exit’); writeln (‘’);
writeln (‘Just write the number:’); readln ©; if © = ‘1’ then begin clrscr; writeln (‘Apple’); writeln (‘Orange’); writeln (‘Mango’); writeln (‘Melon’); end
else if © = ‘2’ then begin clrscr; writeln (‘Lizard’); writeln (‘Monkey’); writeln (‘Cow’); writeln (‘Rabbit’); end
else if © = ‘3’ then begin clrscr;
else if © = ‘4’ then begin clrscr;
writeln (‘Thank you for entering this program’); end
else if © = ‘’ then
writeln (‘The command hasn’t been filled in yet’) else
writeln (‘Sorry, please write the command correctly’); readln; clrscr; until c = ‘4’; writeln (‘’);
writeln (‘Cross-click on the right end of the program or you press Alt + F4’); writeln (‘to exit this program.’); end.
After finishing, first save this source code into PAS extension and then compile after this program and the results are as follows:
The source code above can be changed according to your own wishes, hopefully with this programming tutorial you can get to know Turbo Pascal programming better.
Kurniawan / ^ family_code ^
Copyright / License:
All X-Code Magazine material can be downloaded, read, modified and distributed freely for non-commercial purposes, provided that it does not delete or change the author’s attributes.
Copyright in the hands of the author and X-Code Magazine by following the license GPL (General Public License).
Penulis X-Code Magazine :
^ dry grass ^
^ love doctor