" Kawan, ada empat hal yang tidak dapat diraih kembali...
...batu... setelah dilempar!
...kata-kata... setelah diucapkan!
...kesempatan... setelah berlalu!
...waktu... setelah beranjak pergi! "

borland C++


word puzzle

#include<stdio.h>
#include<string.h>

void main()
{
char kata[3][23][20]={{"die","led","lei","let","lid","lie","lit","tie","deli","diet","edit","idle","lied","tide","tied","tile","tilt","tilde","tiled","title","tilted","titled"},{"ace","can","ens","nee","sac","sea","sec","see","aces","acne","cane","cans","case","ease","sane","scan","seen","canes","cease","scene","encase","seance"},{"eon","hen","her","hoe","ken","nor","one","ore","roe","hero","hoer","hoke","hone","honk","horn","keno","heron","honer","honker"}};
int score=0,benar;
int p=0,j,k,i,level=1,total=0;
char put[3][23][20];
char answer[20];
char press;
char del[20]="aaaaaae";

printf(" Coepoe Word Puzzle \n");
printf(" ================== \n");

printf("Rules :\n\n");
printf("1. Create a word using given characters, min 3 characters & max 6 characters.\n");
printf("2. Each level, You have 10 chances to answer correctly.\n");
printf("3. To get through to next level, you have to score 70 points each level.\n\n");

do{
printf("\n\nLevel %d\n",level);
printf("=========");
if(level==1)
{
printf(" d e t t l i\n\n");
}
else if(level==2)
{
printf(" s e c a e n\n\n");
}
else
{
printf(" h k r n e o\n\n");
}


for(i=1;i<=10;i++)
{
do{
do{
printf("%d> your answer : ",i );
scanf("%s",&answer);
fflush(stdin);
}while(strlen(answer) <3 || strlen (answer) >6);

for(k=0;k<100;k++)
{
if(strcmp(answer,put[level-1][k])==0)
{
printf("You had already type this word before..\n");
break;
}
}
strcpy(put[level-1][p],answer);
p++;
}while(strcmp(answer,put[level-1][k])==0);

for(j=0;j<23;j++)
{
if(strcmp(kata[level-1][j],answer)==0)
{
score=score+10;
printf("you're right. Score : %d\n\n",score);
}

}
}

benar=score/10;
printf("\n\nYou had answered 10 times with %d right answers..\n",benar);

printf("\nCorrect Answers :\n");

for(int s=0;s<23;s++)
{
printf("%s\t",kata[level-1][s]);
}

printf("\n");

for(int z = 0;z<80;z++)
{
printf("%c",4);
}


if (score<60)
{
do{
printf("\nYou Lose!! Try Again..");
printf("\n\nDo you want to retry [y/n] ?");
scanf("%c",&press);
fflush(stdin);
}while(press!='y' && press!='Y' && press!='n' && press!='N');
if(press=='n' || press=='N')
{
break;
}
else
level=1;
score=0;
benar=0;
total=0;

for(int a=0;a<3;a++)
{
for(int b=0;b<23;b++)
{
strcpy(put[a][b],del);
}
}
}

else{
level++;
total=total+score;
score=0;
benar=0;
}

}while(level<=3);

if(level==4)
{
printf("\n\nOverall Score : %d\n",total);
printf("\nYou Win!!\n");
printf("\nPress ENTER to exit...");
getchar();
}

}


Card


#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <string.h>

struct data
{

struct data *next,*prev;
int angka;

}*tail,*curr,*head;

void pkanan(int a)
{

curr=(struct data*) malloc(sizeof (struct data));
curr->angka=a;

if(head==NULL)
{
head=tail=curr;
curr->prev=NULL;
curr->next=NULL;
}

else
{
tail->prev=curr;
curr->next=tail;
tail=curr;
tail->prev=NULL;
}

}

void pkiri(int a)
{

curr=(struct data*) malloc(sizeof (struct data));
curr->angka=a;

if(head==NULL)
{
head=tail=curr;
curr->prev=NULL;
curr->next=NULL;
}

else
{
head->next=curr;
curr->prev=head;
head=curr;
head->next=NULL;
}

}

void cetak()
{
curr=head;
if (curr==NULL)
{
printf("tidak ada data");
}
else
{

while(curr!=NULL)
{
printf("%d ",curr->angka);
curr=curr->prev;
}

}

}

void pa()
{

while(curr!=NULL)
{
curr=head;
head=curr->prev;;
free(curr);
}

}

void man()
{
pkiri(10);
cetak();
printf("\n");

pkiri(20);
pkiri(15);
cetak();
printf("\n");

}

int main()
{

int ada=0;
srand(time(NULL));
int ph=0;
int r1;
int aneh=0;
int r2;
r1=rand()%5+1;
r2=rand()%20+1;
int k1;
int k2;
int win=0;
int score=1000;

do
{
for(int abcd=0;abcd<10;abcd++)
{
printf("\n");
}

if(ada!=1)
{
pkiri(r1);
pkiri(r2);
cetak();
k1=r1;
k2=r2;
}
else
{
if(aneh==1)
{
printf("Tidak Sama");
aneh=0;
}
else
{
k1=rand()%5+1;
k2=rand()%25+1;
cetak();
}
}

printf("\n\n\nAnda Punya Kartu %d %d\n\n\n",k1,k2);
printf("Score Anda = %d",score);
printf("\n\n\n\n1. Gabungkan ke kiri");
printf("\n\n2. Gabungkan ke kanan");
printf("\n\n3. New Card (score -10)");
printf("\n\n4. New Game");
printf("\n\n5. Exit");

printf("\n\n\n\nMasukkan Pilihan Anda = ");
scanf("%d",&ph);
fflush(stdin);

if(ph==1)
{

if(k1==r2)
{
pkiri(k1);
pkiri(k2);
r2=k2;
win++;
}
else if(k2==r2)
{
pkiri(k2);
pkiri(k1);
r2=k1;
win++;

}
else
{
aneh=1;
}
ada=1;

}

else if(ph==2)
{

if(k1==r1)
{
pkanan(k1);
pkanan(k2);
r1=k2;
win++;

}
else if(k2==r1)
{
pkanan(k2);
pkanan(k1);
r1=k1;
win++;
}
else
{
system("cls");
printf("\n\nTidak sama\n\n");
}
ada=1;

}

else if (ph==3)
{
k1=rand()%5+1;
k2=rand()%25+1;
score-=10;
}

else if (ph==4)
{
system("cls");
printf("Masi Eror");
}

else if (ph==5)
{
win=10;
}

}
while(win!=10 && score>=0);

}