Upload files to "/"
This commit is contained in:
90
MG5_n1.fprg
Normal file
90
MG5_n1.fprg
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<flowgorithm fileversion="4.2">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="name" value="GuessThePrice"/>
|
||||||
|
<attribute name="authors" value="yvl"/>
|
||||||
|
<attribute name="about" value=""/>
|
||||||
|
<attribute name="saved" value="2026-03-12 10:14:20 AM"/>
|
||||||
|
<attribute name="created" value="eXZsO1lVVkxJQU5fV0FTX0hFUkU7MjAyNi0wMy0xMjswODozMjoyMyBBTTsxMTEx"/>
|
||||||
|
<attribute name="edited" value="eXZsO1lVVkxJQU5fV0FTX0hFUkU7MjAyNi0wMy0xMjswODozMjoyMyBBTTsxOzExMTE="/>
|
||||||
|
<attribute name="edited" value="eXV2bGlhbjtDT1NNT1M7MjAyNi0wMy0xMjsxMDoxNDoyMCBBTTsxOzI2MDU="/>
|
||||||
|
</attributes>
|
||||||
|
<function name="Main" type="None" variable="">
|
||||||
|
<parameters/>
|
||||||
|
<body>
|
||||||
|
<declare name="targetHarga, angkaTebakan, percobaan, diff" type="Integer" array="False" size=""/>
|
||||||
|
<declare name="diffPersen" type="Real" array="False" size=""/>
|
||||||
|
<declare name="inputTebakan, ket" type="String" array="False" size=""/>
|
||||||
|
<declare name="jawabanBenar" type="Boolean" array="False" size=""/>
|
||||||
|
<assign variable="targetHarga" expression="0"/>
|
||||||
|
<while expression="targetHarga < 10000">
|
||||||
|
<assign variable="targetHarga" expression="Random(200001)"/>
|
||||||
|
</while>
|
||||||
|
<output expression=""DEBUG: targetHarga = " & targetHarga" newline="True"/>
|
||||||
|
<assign variable="percobaan" expression="0"/>
|
||||||
|
<assign variable="jawabanBenar" expression="false"/>
|
||||||
|
<output expression=""Tebak harga barang (Rp 10.000 - Rp 200.000)."" newline="True"/>
|
||||||
|
<output expression=""Ketik nyerah untuk berhenti."" newline="True"/>
|
||||||
|
<while expression="not jawabanBenar and percobaan < 12">
|
||||||
|
<output expression=""Tebakan " & (percobaan + 1) & "/12"" newline="True"/>
|
||||||
|
<output expression=""Masukkan tebakan anda:"" newline="True"/>
|
||||||
|
<input variable="inputTebakan"/>
|
||||||
|
<if expression="inputTebakan = "nyerah"">
|
||||||
|
<then>
|
||||||
|
<output expression=""Jawaban yang benar: Rp " & targetHarga" newline="True"/>
|
||||||
|
<assign variable="percobaan" expression="12"/>
|
||||||
|
</then>
|
||||||
|
<else>
|
||||||
|
<assign variable="angkaTebakan" expression="ToInteger(inputTebakan)"/>
|
||||||
|
<if expression="angkaTebakan < 10000 or angkaTebakan > 200000">
|
||||||
|
<then>
|
||||||
|
<output expression=""Input tidak valid! Masukkan angka antara 10000 sampai 200000."" newline="True"/>
|
||||||
|
</then>
|
||||||
|
<else>
|
||||||
|
<assign variable="percobaan" expression="percobaan + 1"/>
|
||||||
|
<if expression="angkaTebakan = targetHarga">
|
||||||
|
<then>
|
||||||
|
<output expression=""Selamat! Tebakan Anda benar!"" newline="True"/>
|
||||||
|
<assign variable="jawabanBenar" expression="true"/>
|
||||||
|
</then>
|
||||||
|
<else>
|
||||||
|
<assign variable="diffPersen" expression="((angkaTebakan - targetHarga) * 100.0) / targetHarga"/>
|
||||||
|
<if expression="diffPersen > 0">
|
||||||
|
<then>
|
||||||
|
<assign variable="ket" expression=""kelebihan " & diffPersen"/>
|
||||||
|
</then>
|
||||||
|
<else>
|
||||||
|
<assign variable="ket" expression=""kekurangan " & Abs(diffPersen)"/>
|
||||||
|
</else>
|
||||||
|
</if>
|
||||||
|
<if expression="Abs(diffPersen) <= 5">
|
||||||
|
<then>
|
||||||
|
<output expression=""PANAS! (Jawabanmu " & ket & "%)"" newline="True"/>
|
||||||
|
</then>
|
||||||
|
<else>
|
||||||
|
<if expression="Abs(diffPersen) <= 15">
|
||||||
|
<then>
|
||||||
|
<output expression=""HANGAT! (Jawabanmu " & ket & "%)"" newline="True"/>
|
||||||
|
</then>
|
||||||
|
<else>
|
||||||
|
<output expression=""DINGIN! (Jawabanmu " & ket & "%)"" newline="True"/>
|
||||||
|
</else>
|
||||||
|
</if>
|
||||||
|
</else>
|
||||||
|
</if>
|
||||||
|
</else>
|
||||||
|
</if>
|
||||||
|
</else>
|
||||||
|
</if>
|
||||||
|
</else>
|
||||||
|
</if>
|
||||||
|
</while>
|
||||||
|
<if expression="not jawabanBenar and percobaan = 12 and inputTebakan != "nyerah"">
|
||||||
|
<then>
|
||||||
|
<output expression=""Kesempatan habis! Jawaban yang benar: " & targetHarga" newline="True"/>
|
||||||
|
</then>
|
||||||
|
<else/>
|
||||||
|
</if>
|
||||||
|
</body>
|
||||||
|
</function>
|
||||||
|
</flowgorithm>
|
||||||
2
MG5_n2.fprg
Normal file
2
MG5_n2.fprg
Normal file
File diff suppressed because one or more lines are too long
113
MG5_n3.fprg
Normal file
113
MG5_n3.fprg
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<flowgorithm fileversion="4.2">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="name" value="KuisInteraktif"/>
|
||||||
|
<attribute name="authors" value="yvl"/>
|
||||||
|
<attribute name="about" value=""/>
|
||||||
|
<attribute name="saved" value="2026-03-12 10:06:21 AM"/>
|
||||||
|
<attribute name="created" value="eXZsO1lVVkxJQU5fV0FTX0hFUkU7MjAyNi0wMy0xMjsxMDowMTowNCBBTTsxMTEx"/>
|
||||||
|
<attribute name="edited" value="eXZsO1lVVkxJQU5fV0FTX0hFUkU7MjAyNi0wMy0xMjsxMDowMTowNCBBTTsxOzExMTE="/>
|
||||||
|
<attribute name="edited" value="eXV2bGlhbjtDT1NNT1M7MjAyNi0wMy0xMjsxMDowNjoyMSBBTTsyOzI2MDg="/>
|
||||||
|
</attributes>
|
||||||
|
<function name="Main" type="None" variable="">
|
||||||
|
<parameters/>
|
||||||
|
<body>
|
||||||
|
<declare name="score, salahBeruntun, soalDijawab, pilihan, inputCode" type="Integer" array="False" size=""/>
|
||||||
|
<declare name="jawaban" type="String" array="False" size=""/>
|
||||||
|
<declare name="inputValid" type="Boolean" array="False" size=""/>
|
||||||
|
<declare name="daftarSoal" type="String" array="True" size="5"/>
|
||||||
|
<declare name="daftarPilihan" type="String" array="True" size="5"/>
|
||||||
|
<declare name="kodeJawaban" type="Integer" array="True" size="5"/>
|
||||||
|
<call expression="setSoal(daftarSoal, daftarPilihan, kodeJawaban, 0, "Soal 1: Ibukota Indonesia adalah?", "a. Jakarta b. Surabaya c. Bandung d. Medan", ToCode("a"))"/>
|
||||||
|
<call expression="setSoal(daftarSoal, daftarPilihan, kodeJawaban, 1, "Soal 2: 2 + 2 = ?", "a. 3 b. 4 c. 5 d. 6", ToCode("b"))"/>
|
||||||
|
<call expression="setSoal(daftarSoal, daftarPilihan, kodeJawaban, 2, "Soal 3: Warna langit?", "a. Hijau b. Biru c. Merah d. Kuning", ToCode("b"))"/>
|
||||||
|
<call expression="setSoal(daftarSoal, daftarPilihan, kodeJawaban, 3, "Soal 4: Hewan berkaki empat?", "a. Ayam b. Ikan c. Kucing d. Burung", ToCode("c"))"/>
|
||||||
|
<call expression="setSoal(daftarSoal, daftarPilihan, kodeJawaban, 4, "Soal 5: 5 x 5 = ?", "a. 20 b. 25 c. 30 d. 35", ToCode("b"))"/>
|
||||||
|
<assign variable="score" expression="0"/>
|
||||||
|
<assign variable="salahBeruntun" expression="0"/>
|
||||||
|
<assign variable="soalDijawab" expression="0"/>
|
||||||
|
<assign variable="pilihan" expression="0"/>
|
||||||
|
<output expression=""Selamat datang di Kuis Interaktif!"" newline="True"/>
|
||||||
|
<while expression="pilihan != 3">
|
||||||
|
<output expression=""Menu:"" newline="True"/>
|
||||||
|
<output expression=""1. Jawab Soal Berikutnya"" newline="True"/>
|
||||||
|
<output expression=""2. Lihat Skor"" newline="True"/>
|
||||||
|
<output expression=""3. Keluar"" newline="True"/>
|
||||||
|
<output expression=""Pilihan: "" newline="False"/>
|
||||||
|
<input variable="pilihan"/>
|
||||||
|
<if expression="pilihan == 1">
|
||||||
|
<then>
|
||||||
|
<output expression="daftarSoal[soalDijawab]" newline="True"/>
|
||||||
|
<output expression="daftarPilihan[soalDijawab]" newline="True"/>
|
||||||
|
<assign variable="inputValid" expression="false"/>
|
||||||
|
<while expression="not inputValid">
|
||||||
|
<output expression=""Jawaban (a/b/c/d): "" newline="False"/>
|
||||||
|
<input variable="jawaban"/>
|
||||||
|
<if expression="Len(jawaban) > 0">
|
||||||
|
<then>
|
||||||
|
<assign variable="inputValid" expression="jawaban == "a" or jawaban == "b" or jawaban == "c" or jawaban == "d""/>
|
||||||
|
</then>
|
||||||
|
<else>
|
||||||
|
<output expression=""Input tidak boleh kosong!"" newline="True"/>
|
||||||
|
</else>
|
||||||
|
</if>
|
||||||
|
</while>
|
||||||
|
<assign variable="inputCode" expression="ToCode(Char(jawaban, 0))"/>
|
||||||
|
<if expression="inputCode == kodeJawaban[soalDijawab]">
|
||||||
|
<then>
|
||||||
|
<assign variable="score" expression="score + 20"/>
|
||||||
|
<assign variable="salahBeruntun" expression="0"/>
|
||||||
|
<output expression=""Benar! Skor Anda: " & score" newline="True"/>
|
||||||
|
</then>
|
||||||
|
<else>
|
||||||
|
<assign variable="salahBeruntun" expression="salahBeruntun + 1"/>
|
||||||
|
<output expression=""Salah! (Salah beruntun: " & salahBeruntun & ")"" newline="True"/>
|
||||||
|
</else>
|
||||||
|
</if>
|
||||||
|
<assign variable="soalDijawab" expression="soalDijawab + 1"/>
|
||||||
|
<if expression="salahBeruntun == 3">
|
||||||
|
<then>
|
||||||
|
<output expression=""Anda telah salah 3 kali berturut-turut. Kuis berhenti."" newline="True"/>
|
||||||
|
<assign variable="pilihan" expression="3"/>
|
||||||
|
</then>
|
||||||
|
<else>
|
||||||
|
<if expression="soalDijawab == 5">
|
||||||
|
<then>
|
||||||
|
<output expression=""Semua soal telah dijawab."" newline="True"/>
|
||||||
|
<assign variable="pilihan" expression="3"/>
|
||||||
|
</then>
|
||||||
|
<else/>
|
||||||
|
</if>
|
||||||
|
</else>
|
||||||
|
</if>
|
||||||
|
</then>
|
||||||
|
<else>
|
||||||
|
<if expression="pilihan == 2">
|
||||||
|
<then>
|
||||||
|
<output expression=""Skor saat ini: " & score" newline="True"/>
|
||||||
|
</then>
|
||||||
|
<else/>
|
||||||
|
</if>
|
||||||
|
</else>
|
||||||
|
</if>
|
||||||
|
</while>
|
||||||
|
<output expression=""Skor akhir Anda: " & score" newline="True"/>
|
||||||
|
</body>
|
||||||
|
</function>
|
||||||
|
<function name="setSoal" type="None" variable="">
|
||||||
|
<parameters>
|
||||||
|
<parameter name="sArr" type="String" array="True"/>
|
||||||
|
<parameter name="pArr" type="String" array="True"/>
|
||||||
|
<parameter name="jArr" type="Integer" array="True"/>
|
||||||
|
<parameter name="idx" type="Integer" array="False"/>
|
||||||
|
<parameter name="tSoal" type="String" array="False"/>
|
||||||
|
<parameter name="tPilihan" type="String" array="False"/>
|
||||||
|
<parameter name="nJawaban" type="Integer" array="False"/>
|
||||||
|
</parameters>
|
||||||
|
<body>
|
||||||
|
<assign variable="sArr[idx]" expression="tSoal"/>
|
||||||
|
<assign variable="pArr[idx]" expression="tPilihan"/>
|
||||||
|
<assign variable="jArr[idx]" expression="nJawaban"/>
|
||||||
|
</body>
|
||||||
|
</function>
|
||||||
|
</flowgorithm>
|
||||||
Reference in New Issue
Block a user