Tampilkan postingan dengan label struktur data. Tampilkan semua postingan
Tampilkan postingan dengan label struktur data. Tampilkan semua postingan

TTS ver2

Diposting oleh Rini Pujiati on Rabu, 26 Oktober 2011

char tts[5][13]={"AIR MINUMAN D",
" N K A A UVO",
"ADIL BIASA IA",
" A EPIK AS S ",
" HADIR AKIBAT"};


int angka[5][13]={1, 2, 0, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 9, 0,
10, 0, 0, 11,0, 12,0, 0, 0, 13,0, 14, 0,
0, 0, 0, 15,16,0 ,0, 0, 17, 0,0, 0, 0,
0,18, 0, 0,0 ,0 ,0, 19,0 , 0,0, 0, 0};

char jawab[5][13]={" * * ",
"* ** * * * ",
" * * ",
"* * * * *",
"* * "};

main()
{ int a,b,brs,klm,tekan,bb=13,kk=20,bekb,bekk,posx=2,posy=5,bekposx,bekposy;
int benar=0,salah=0;
clrscr();
gotoxy(5,2);printf("APLIKASI PERMAINAN TEKA-TEKI SILANG");
gotoxy(1,22);printf("Cara Bermain : Pilih Kotak, Tekan Enter...");
gotoxy(1,23);printf(" Kemudian Isi Huruf KAPITAL!");
gotoxy(1,24);printf("Dibuat Oleh : feriag@yahoo.com");
area();
do
{
textcolor(15);
gotoxy(kk,bb);cprintf("%c",219);
bekb=bb;bekk=kk;
bekposx=posx; bekposy=posy;
tekan=getch();
if(tekan==75) {kk=kk-3;posy--;}
if(tekan==77) {kk=kk+3;posy++;}
if(tekan==72) {bb=bb-3;posx--;}
if(tekan==80) {bb=bb+3;posx++;}
if(tekan==13)
{ menjawab(bb,kk,posx,posy);
ctkjawab();
}
if((tts[posx][posy]==' ') || (posx<0) || (posx>4) || (posy<0) || (posy>12))
{
posx=bekposx; posy=bekposy; bb=bekb; kk=bekk;
}
gotoxy(bekk,bekb);printf(" ");


}
while(tekan!=27);
b=40;
for(a=0;a<=40;a++)
{
for(brs=1;brs<25;brs++)
{
gotoxy(b-a,brs);printf(" ");
gotoxy(b+a,brs);printf(" ");
}
delay(5000);
}
for(a=0;a<5;a++)
{
for(b=0;b<13;b++)
{
if(jawab[a][b]==tts[a][b]) benar++;
else salah++;
}
}
gotoxy(5,5);printf("Hasil Rekapitulasi Jawaban");
gotoxy(5,7);printf("Jumlah Isian Benar : %d", benar);
gotoxy(5,8);printf("Jumlah Isian Salah : %d", salah-17);
gotoxy(5,9);printf("Jumlah Kotak diarsir : %d", 17);

getch();
}









area()
{
int x,y,brs,klm;
for(x=3;x<45;x=x+3)
{ for(y=6;y<20;y++)
{gotoxy(x,y);printf("|");
}
}
for(x=5;x<23;x=x+3)
{
for(y=3;y<=42;y++)
{
gotoxy(y,x);printf("-");
}
}


brs=3;
for(x=0;x<5;x++)
{
brs=brs+3;
klm=4;
for(y=0;y<13;y++)
{
if(angka[x][y]!=0)
{
gotoxy(klm,brs);printf("%d",angka[x][y]);
}
klm=klm+3;
}
}

brs=3;
for(x=0;x<5;x++)
{
brs=brs+3;
klm=4;
for(y=0;y<13;y++)
{
if(tts[x][y]==' ')
{
gotoxy(klm,brs);printf("%c",177);
gotoxy(klm+1,brs);printf("%c",177);
gotoxy(klm,brs+1);printf("%c",177);
gotoxy(klm+1,brs+1);printf("%c",177);
}
klm=klm+3;
}
}

gotoxy(45,1);printf("MENDATAR");
gotoxy(45,2);printf("1. Water (Bhs. indonesia)");
gotoxy(45,3);printf("3. Softdrink adalah Jenis ...");
gotoxy(45,4);printf("8. Piring Terbang");
gotoxy(45,5);printf("10. Sesuai peruntukannya");
gotoxy(45,6);printf("12.Tidak hebat");
gotoxy(45,7);printf("13.Kata ganti orang kedua");
gotoxy(45,8);printf("15.Kisah kepahlawanan");
gotoxy(45,9);printf("17.Negara Adikuasa");
gotoxy(45,10);printf("18.Ada");
gotoxy(45,11);printf("19.Ada Sebab ada ...");

gotoxy(45,13);printf("MENURUN");
gotoxy(45,14);printf("2. Sedap dipandang mata");
gotoxy(45,15);printf("3. Mahkamah Konstitusi");
gotoxy(45,16);printf("4. Tidak Turun");
gotoxy(45,17);printf("5. Matang");
gotoxy(45,18);printf("6. Organisasi Islam");
gotoxy(45,19);printf("7. Harap");
gotoxy(45,20);printf("9. Surat ijin tinggal dinegara lain");
gotoxy(45,21);printf("11.Lampu Elektronika yg kecil");
gotoxy(45,22);printf("12.Jenis Minuman keras");
gotoxy(45,23);printf("13.Air Susu Ibu");
gotoxy(45,24);printf("16.Perhimpunan Indonesia");



}

ctkjawab()
{
int brs,x,y,klm;
brs=4;
for(x=0;x<5;x++)
{
brs=brs+3;
klm=4;
for(y=0;y<13;y++)
{
if(jawab[x][y]!='*')
{gotoxy(klm,brs);printf("%c",jawab[x][y]);}
klm=klm+3;
}
}
}

menjawab(int b, int k,int px, int py)
{
char jwb;
textcolor(0);
gotoxy(5,21);printf("Silahkan Ketik Satu Huruf Jawaban...");
gotoxy(k,b);cprintf(" ");
gotoxy(k-1,b);jwb=getch();
jawab[px][py]=jwb;
gotoxy(5,21
);printf(" ");
}
More aboutTTS ver2

TTS

Diposting oleh Rini Pujiati on Senin, 24 Oktober 2011

char tts[7][8]={"MALAKA P", /*"AIR MINUMAN D",*/
"A E A R", /*" N K A A UVO",*/
"K L RASA", /*"ADIL BIASA IA",*/
"ANEKA B", /* " A EPIK AS S ", */
"N N U", /*" HADIR AKIBAT" */
" PUNGLI ",
" N "};
int angka[7][8]={ 1, 0, 2, 0, 3, 0, 0, 4, /*1, 2, 0, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7,*/
0, 0, 0, 0, 0, 0, 0, 0, /* 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0,*/
0, 0, 0, 0, 5, 0, 0, 0, /*9, 0, 0, 10,0, 11,0, 0, 0, 12,0, 0, 0, */
6, 0, 0, 0, 0, 0, 0, 0, /*0, 0, 0, 13,14,0 ,0, 0, 15, 0,0, 0, 0, */
0, 0, 0, 0, 0, 0, 0, 0, /*0,16, 0, 0,0 ,0 ,0, 17,0 , 0,0, 0, 0};*/
0, 7, 8, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0};


char jawab[7][8];
int nilai=0;


main()
{ int a,b,brs,klm;
clrscr();

pertanyaan();
area();

/* kunci

brs=1;
for(a=0;a<7;a++)
{
brs=brs+3;
klm=5;
for(b=0;b<8;b++)
{
if(tts[a][b]==' ')
{
gotoxy(klm,brs);printf("%c",177);
} else
{
gotoxy(klm,brs);printf("%c", tts[a][b]);
} klm=klm+3; } } */
}
area()
{
int x,y,brs,klm,tombol;
char huruf;

for(x=3;x<28;x=x+3)
{
for(y=3;y<23;y++)
{
gotoxy(x,y);printf("|");
}
}
for(x=2;x<26;x=x+3)
{
for(y=3;y<=27;y++)
{
gotoxy(y,x);printf("-");
}
}
brs=0;
for(x=0;x<7;x++)
{
brs=brs+3;
klm=4;
for(y=0;y<8;y++)
{
if(angka[x][y]!=0)
{
gotoxy(klm,brs);printf("%d",angka[x][y]);
}
klm=klm+3;
}
}
brs=0;
for(x=0;x<7;x++)
{
brs=brs+3;
klm=4;
for(y=0;y<8;y++)
{
if(tts[x][y]==' ')
{
gotoxy(klm,brs);printf("%c",177);
gotoxy(klm+1,brs);printf("%c",177);
gotoxy(klm,brs+1);printf("%c",177);
gotoxy(klm+1,brs+1);printf("%c",177);
}
klm=klm+3;
}
}
brs=16;
klm=16;
gotoxy(brs,klm);printf("o");
do {
tombol=getch();
gotoxy(50,24);
printf("kode tombol : %d ", tombol);
gotoxy(klm,brs);printf(" ");
if(tombol==75) /*panah kiri*/
{
klm=klm-3;
if(tts[x][y]==' ')
{
klm=klm+3;
}
}
if(tombol==77) /*panah kanan*/
{
klm=klm+3;
if(tts[x][y]==' ')
{
klm=klm-3;
}
}
if(tombol==72) /*panah atas*/
{
brs=brs-3;
if(tts[x][y]==' ')
{
brs=brs+3;
}
}
if(tombol==80) /*panah bawah*/
{
brs=brs+3;
if(tts[x][y]==' ')
{
brs=brs-3;
}
if(brs==20)
{
brs=brs;
}
}
if(tombol==13) /*Enter*/
{
gotoxy(klm+1,brs);scanf("%s", &huruf);
jawab[x][y]=huruf;
if(strcmp(tts[x][y],jawab[x][y]))
{
nilai=nilai+5;
gotoxy(40,20);printf("Nilai : %d \n", nilai);
gotoxy(5,25);printf("Jawaban Benar");
} else
{
nilai=nilai-2;
gotoxy(40,20);printf("Nilai : %d \n", nilai);
gotoxy(5,25);printf("jawaban baris ke %d kolom %d salah \n", brs,klm);
}
}
if(klm<3) klm=4; if(klm>27) klm=27;
if(brs<3) brs=4; if(brs>23) brs=21;
gotoxy(klm,brs);printf("o");
}

while((tombol!=27)||(nilai<0)); /*27=escape*/

}



pertanyaan()
{
gotoxy(40,3);printf("MENDATAR");
gotoxy(40,5);printf("1. Malaysia");
gotoxy(40,6);printf("5. Pahit, Kecut, Manis");
gotoxy(40,7);printf("6. Beragam Jenis ");
gotoxy(40,8);printf("7. Pungutan Liar ");
gotoxy(40,10);printf("MENURUN");
gotoxy(40,11);printf("1. Kebutuhan Primer Semua");
gotoxy(40,12);printf(" Makhluk Hidup");
gotoxy(40,13);printf("2. Jenis ikan Air Tawar");
gotoxy(40,14);printf("3. Jenis Tumbuhan yang Hidup");
gotoxy(40,15);printf(" di laut");
gotoxy(40,16);printf("4. Sebutan untuk Raja di Jawa ");
gotoxy(40,17);printf("8. Ujian Nasional");
gotoxy(40,18);printf("Nb : Diisi dgn Huruf Kapital");
gotoxy(40,20);printf("Nilai : 0 \n");

}
More aboutTTS

Struktur Data ADT

Diposting oleh Rini Pujiati on Kamis, 06 Oktober 2011

kalo belum ada turbo C silahkan download di sini

File materi kamis siang silahkan download disini

- procedure n Function
- ADT
type data bentukan
type data yang dibentuk oleh programmer sendiri...
----------------------------------------------------------------
Hierarchy Data :
- Huruf / Bit, byte
- Variabel / Field : kumpulan huruf/angka
- Record / Struktur : kumpulan variabel
- File / Table
- Database
- Super Database
-

----------------------------------------------------------------

contoh :
a. Tanggal
b. Waktu
c. pixel

-----------------------------------------------------------------
struct tanggal
{
int tgl, bln, thn;
};



main()
{
struct tanggal now;

clrscr();

now.tgl = 31;
now.bln = 12;
now.thn = 2011;

printf("\n Sekarang : ");tampil(now);
printf("\n Besok : ");tomorrow(now);
printf("\n Kemarin : ");yesterday(now);
printf("\n N day after now ");
printf("\n N day Before Now");


getch();
}


int maks_hari(int bulane, int tahune)
{
if ((bulane==1) || (bulane==3) || (bulane==5) || (bulane==7) || (bulane==8) || (bulane==10) || (bulane==12))
return 31;
else
if((bulane==2) && ((tahune % 4) !=0))
return 28;
else
if((bulane==2) && ((tahune % 4) == 0))
return 29;
else
return 30;
}



tomorrow(struct tanggal y)
{
int tgl_akhir;

tgl_akhir=maks_hari(y.bln, y.thn);

if(y.tgl == tgl_akhir)
{
if(y.bln==12)
{
y.tgl=1;
y.bln=1;
y.thn++;
}
else
{
y.tgl=1;
y.bln++;
}
}
else
{
y.tgl++;
}

tampil(y);
}




tampil(struct tanggal x)
{
switch(x.bln)
{ case 1 : printf("%d Januari %d", x.tgl, x.thn);break;
case 2 : printf("%d Februari %d", x.tgl, x.thn);break;
case 3 : printf("%d Maret %d", x.tgl, x.thn);break;
case 4 : printf("%d April %d", x.tgl, x.thn);break;
case 5 : printf("%d Mei %d", x.tgl, x.thn);break;
case 6 : printf("%d Juni %d", x.tgl, x.thn);break;
case 7 : printf("%d Juli %d", x.tgl, x.thn);break;
case 8 : printf("%d Agustus %d", x.tgl, x.thn);break;
case 9 : printf("%d September %d", x.tgl, x.thn);break;
case 10 : printf("%d Oktober %d", x.tgl, x.thn);break;
case 11 : printf("%d Nopember %d", x.tgl, x.thn);break;
case 12 : printf("%d Desember %d", x.tgl, x.thn);break;
}
}
More aboutStruktur Data ADT