forked from kevin2000141/TubesDasPro
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram F9_F10_F11.pas
More file actions
42 lines (36 loc) · 1.19 KB
/
Program F9_F10_F11.pas
File metadata and controls
42 lines (36 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Program F9_F10_F11;
uses
F11_tidur,F9_makan,F10_istirahat,uDef,F1,sysutils;
var
text :String; // Tempat membaca masukan perintah yg diinginkan
i :Integer; // Counter array
begin
//Inisialisasi
countm :=1;
countis :=1;
i :=2;
//Algoritma
repeat
writeln('Masukkan perintah yang diinginkan');
readln(teks);
if (teks='tidur') and (countm=1) and (countis=1) then //perintah tidur jika belom dilakukan aksi apa-apa
begin
repeat
writeln('Gabisa tidur sebelom kerja');
readln(teks);
until (teks<>'tidur');
end else if (teks='tidur') and ((countm<>1) or (countis<>1)) then //perintah tidur jika sudah dilakukan at least 1 aksi
tidur(FESimulasi[1].tEnergi,countm,countis,FESimulasi[NomorSim].tHarihidup,FESimulasi[NomorSim].tanggal);
if (teks='makan') then
begin
makan(FESimulasi[i-1].tEnergi,countm);
FESimulasi[i].tEnergi:=(FESimulasi[i-1].tEnergi);
i:=i+1;
end;
if (teks='istirahat') then
begin
istirahat(FESimulasi[i-1].tEnergi,countis);
FESimulasi[i].tEnergi:=(FESimulasi[i-1].tEnergi);
i:=i+1;
end;
until (teks='tidur'); //Looping berhenti ketika text input text adalah tidur