Files
flowgorithm/MG5_n3.fprg
2026-03-12 04:15:07 +00:00

114 lines
7.3 KiB
XML

<?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, &quot;Soal 1: Ibukota Indonesia adalah?&quot;, &quot;a. Jakarta b. Surabaya c. Bandung d. Medan&quot;, ToCode(&quot;a&quot;))"/>
<call expression="setSoal(daftarSoal, daftarPilihan, kodeJawaban, 1, &quot;Soal 2: 2 + 2 = ?&quot;, &quot;a. 3 b. 4 c. 5 d. 6&quot;, ToCode(&quot;b&quot;))"/>
<call expression="setSoal(daftarSoal, daftarPilihan, kodeJawaban, 2, &quot;Soal 3: Warna langit?&quot;, &quot;a. Hijau b. Biru c. Merah d. Kuning&quot;, ToCode(&quot;b&quot;))"/>
<call expression="setSoal(daftarSoal, daftarPilihan, kodeJawaban, 3, &quot;Soal 4: Hewan berkaki empat?&quot;, &quot;a. Ayam b. Ikan c. Kucing d. Burung&quot;, ToCode(&quot;c&quot;))"/>
<call expression="setSoal(daftarSoal, daftarPilihan, kodeJawaban, 4, &quot;Soal 5: 5 x 5 = ?&quot;, &quot;a. 20 b. 25 c. 30 d. 35&quot;, ToCode(&quot;b&quot;))"/>
<assign variable="score" expression="0"/>
<assign variable="salahBeruntun" expression="0"/>
<assign variable="soalDijawab" expression="0"/>
<assign variable="pilihan" expression="0"/>
<output expression="&quot;Selamat datang di Kuis Interaktif!&quot;" newline="True"/>
<while expression="pilihan != 3">
<output expression="&quot;Menu:&quot;" newline="True"/>
<output expression="&quot;1. Jawab Soal Berikutnya&quot;" newline="True"/>
<output expression="&quot;2. Lihat Skor&quot;" newline="True"/>
<output expression="&quot;3. Keluar&quot;" newline="True"/>
<output expression="&quot;Pilihan: &quot;" 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="&quot;Jawaban (a/b/c/d): &quot;" newline="False"/>
<input variable="jawaban"/>
<if expression="Len(jawaban) &gt; 0">
<then>
<assign variable="inputValid" expression="jawaban == &quot;a&quot; or jawaban == &quot;b&quot; or jawaban == &quot;c&quot; or jawaban == &quot;d&quot;"/>
</then>
<else>
<output expression="&quot;Input tidak boleh kosong!&quot;" 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="&quot;Benar! Skor Anda: &quot; &amp; score" newline="True"/>
</then>
<else>
<assign variable="salahBeruntun" expression="salahBeruntun + 1"/>
<output expression="&quot;Salah! (Salah beruntun: &quot; &amp; salahBeruntun &amp; &quot;)&quot;" newline="True"/>
</else>
</if>
<assign variable="soalDijawab" expression="soalDijawab + 1"/>
<if expression="salahBeruntun == 3">
<then>
<output expression="&quot;Anda telah salah 3 kali berturut-turut. Kuis berhenti.&quot;" newline="True"/>
<assign variable="pilihan" expression="3"/>
</then>
<else>
<if expression="soalDijawab == 5">
<then>
<output expression="&quot;Semua soal telah dijawab.&quot;" newline="True"/>
<assign variable="pilihan" expression="3"/>
</then>
<else/>
</if>
</else>
</if>
</then>
<else>
<if expression="pilihan == 2">
<then>
<output expression="&quot;Skor saat ini: &quot; &amp; score" newline="True"/>
</then>
<else/>
</if>
</else>
</if>
</while>
<output expression="&quot;Skor akhir Anda: &quot; &amp; 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>