Examples of algorithms in C language games

Examples of algorithms in C language games

if you want to make games in C or C + + should choose

educational games that smell

Do not make a lot of animated games

because

a. difficult

b. length of source code

c. must make the first graphic

examples of educational game I've ever made:




/* File : Luas.C

Deskripsi : Program Latihan Menghitung Luas Bangun Datar

Update : 26 Desember 2007 13:27 */

#include

#include

#include

benar ();

l_persegi ();

l_p_panj ();

l_segi3 ();

l_j_genjang ();

l_b_ketupat ();

l_trapesium ();

l_lingkaran ();

panah ();

int main ()

{

/* KAMUS */

int pil; /* Pilihan */

int h; /* hasil */

char pil2; /* pilihan 2*/

/* PROGRAM */

mulai: {panah ();};

nosound ();

gotoxy (28,3);

printf (“Mari Belajar Menghitung”);

gotoxy (28,6);

printf (“Luas Bangun Datar”);

gotoxy (28,8);

printf (“Pilih bangun yang akan dipakai”);

gotoxy (28,9);

printf (“untuk latihan”);

gotoxy (28,12);

printf (“1. Persegi”);

gotoxy (28,13);

printf (“2. Persegi Panjang”);

gotoxy (28,14);

printf (“3. Segitga”);

gotoxy (28,15);

printf (“4. Jajar Genjang”);

gotoxy (28,16);

printf (“5. Belah Ketupat”);

gotoxy (28,17);

printf (“6. Trapesium”);

gotoxy (28,18);

printf (“7. Lingkaran”);

gotoxy (28,19);

printf (“8. Keluar”);

gotoxy (28,22);

pilih: {printf (“Masukkan pilihan angka :”);};

scanf (“%d”, &pil);

switch (pil)

{

case 1 : {h = l_persegi(); break;}

case 2 : {h = l_p_panj(); break;}

case 3 : {h = l_segi3(); break;}

case 4 : {h = l_j_genjang(); break;}

case 5 : {h = l_b_ketupat(); break;}

case 6 : {h = l_trapesium(); break;}

case 7 : {h = l_lingkaran(); break;}

case 8 :

{

clrscr();

panah ();

gotoxy (32,12);

nosound();

printf (“Terima kasih\n”);

getch();

return 0;

}

default:

{

printf (“Angka salah\n”);

goto pilih;

}

0 comments:

Post a Comment