#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<string.h>
int main()
{
char arr[][20]={"adana","afyonkarahisar","amasya","ankara","anta lya","artvin","bilecik","bitlis","bolu","burdur",
"bursa","denizli","edirne","erzincan","erzurum","g aziantep","giresun","hakkari","hatay","mersin",
"istanbul","izmir","kars","kastamonu","kayseri","k ocaeli","konya","malatya","manisa","mardin",
"ordu","rize","sakarya","samsun","siirt","sinop"," sivas","tokat","trabzon","tunceli",
"van","yozgat","zonguldak","aksaray","bayburt","ka raman","batman","ardahan","yalova","kilis","osmani ye"};
char harf;
char toplam[15]={'&','&','&','&','&','&','&','&','&','&','&','&', '&','&','&'};
int i,size=0,x,y=0,d=0,t=0;
srand(time(NULL));
printf("can you guess this city?\n");
x=0+rand()%50;
size=strlen(arr[x]);
for(i=0;i<size;i++)
{
printf("__ ");
}
printf("\n");
while(y<5)
{
printf("\nenter a letter: ");
fflush(stdin);
scanf("%c",&harf);
for(i=0;i<size;i++)
{
if(harf==arr[x][i])
{
toplam[i]=harf;
d++;
t++;
}
}
if(d==0)
{
printf("\a");
y++;
}
if(d!=0)
{
for(i=0;i<size;i++)
{
if(toplam[i]!='&')
{
printf("%c ",toplam[i]);
}
else
{
printf("__ ");
}
}
}
else
{
printf("%d. hakkinizi doldurdunuz\n",y);
if(y!=5)
{
printf("%d hakkiniz kaldi\n",5-y);
}
if(y==5)
{
printf("GAME OVER!!!\n");
printf("dogru cevap '%s' olacakti\n\n",arr[x]);
}
}
if(t==size)
{
printf("\n\nTEBRIKLER !!!\n");
break;
}
d=0;
printf("\n");
}
printf("\n");
system("pause");
return(0);
}