PHP Kod: Kodu kopyalamak için üzerine çift tıklayın!
//IBRAHIM ATAY 040202011
#include <stdio.h>
#include <graphics.h>
#include <stdlib.h>
#include <ctype.h>
#include <conio.h>
#include <math.h>
#include <mouse.h>
#include <time.h>
#include <string.h>
#include <dos.h>
#define BUT1PRESSED 1
#define BUT2PRESSED 2
#define TRUE 1
#define FALSE 0
struct kullanici{
char isim[20];
char sifre[20];
}kisi;
void menu();
void kayit();
void yukle();
void credit();
void grafik();
void cark();
int u=0,y,q=0;
double puan=0;
char *bul[18]={"KAHRAMANMARAS","MALATYA","TRABZON","CANAKKALE","ADANA",
"SANLIURFA","ERZURUM","KONYA","ANKARA","AFYON","€ORUM",
"AMASYA","ANTALYA","ISPARTA","KIRIKKALE","SAMSUN","BURSA"
"ADIYAMAN"};
char *p[16]={"100","400","200","550","1000","800","5000","2500","250","300","750","650","150","400","10000","iflas"};
void grafik()
{ int x,y;
setbkcolor(0);
int mou***, mouseY, mouseButton=0;
char button1Down=FALSE,button2Down=FALSE,kay;
setfillstyle(7,1);
bar(0,0,639,479);
setfillstyle(1,9);
for (x=3;x<=560;x+=22)
{
bar(x,400,x+20,420);
}
settextstyle(1,0,1);
setcolor(6);
x=3;
outtextxy(x+5,398,"A");outtextxy(x+27,398,"B");outtextxy(x+49,398,"C");
outtextxy(x+71,398,"€");outtextxy(x+94,398,"D");outtextxy(x+115,398,"E");
outtextxy(x+137,398,"F");outtextxy(x+157,398,"G");outtextxy(x+179,398,"H");
outtextxy(x+205,398,"i");outtextxy(x+226,398,"J");outtextxy(x+246,398,"K");
outtextxy(x+269,398,"L");outtextxy(x+290,398,"M");outtextxy(x+312,398,"N");
outtextxy(x+335,398,"O");outtextxy(x+356,399,"™");outtextxy(x+379,398,"P");
outtextxy(x+400,398,"R");outtextxy(x+424,398,"S");outtextxy(x+445,398,"T");
outtextxy(x+467,398,"U"); outtextxy(x+488,399,"š");outtextxy(x+511,398,"V");
outtextxy(x+531,398,"Y"); outtextxy(x+555,398,"Z");
setcolor(10);
settextstyle(7,1,4);
outtextxy(2,40,"CARKIFELEK 2006");
settextstyle(7,0,1);
setcolor(2);
outtextxy(120,430,"KOCAELI šNIVERSITESI BILGISAYAR MUHENDISLIGI");
outtextxy(180,450,"Programi Yazan ..: Hseyin Ahmet Akben");
settextstyle(3,0,2);
setcolor(2);
outtextxy(260,30,"---------ACIKLAMA----------");
outtextxy(260,50,"Carki Cevir'e tiklayip oyuna baslayin.");
outtextxy(260,70,"Cark durunca klavyeden harf girin.");
outtextxy(260,90,"Harf girislerini yaparken CAPSLOCK'un");
outtextxy(270,110,"acik olmasina dikkat edin.");
outtextxy(270,130," Cikis yada yeni oyun secenegi");
outtextxy(270,150," secenegi icin sag tiklayin. <ENTER>");
getch();
setfillstyle(11,1);
bar(5,435,111,465);
setfillstyle(2,7);
pieslice(640,0,180,270,400);
setfillstyle(1,4);
pieslice(320,130,145,175,30);
setfillstyle(11,7);
bar(435,300,552,325);
setcolor(6);
settextstyle(7,0,0);
outtextxy(10,430,"CIKIS");
settextstyle(1,0,2);
setcolor(4);
outtextxy(440,300,"Carki Cevir");
if (!ResetMouse())
{//3
printf("Mouse Surucusu Yok");
getch();
exit(1);
}//3
for(;;){//4
ActivMouse( );
ShowMouse();
tekrar:
ReadMouse(&mouseY,&mou***,&mouseButton);
if (mouseButton&BUT1PRESSED)
button1Down=TRUE;
else if (button1Down)
{//5
button1Down=FALSE;
if ((mou***>5) && mou***<100)
if ((mouseY>435) && mouseY<460)
exit(1);
scanf("");
if ((mou***>435) && mou***<552)
if ((mouseY>300) && mouseY<325){//6
cark();
}//6
}//5
if (mouseButton&BUT2PRESSED)
button2Down=TRUE;
else if (button2Down)
{//10
button2Down=FALSE;
setcolor(6);
settextstyle(1,0,2);
sag:
outtextxy(10,375,"Cikmak icin ESC Yeni Oyun icin ENTER e Basin");
kay=getch();
while ((kay!=27) && kay!=13)
kay=getch();
if (kay==13){
u=0;puan=0,q=0;
grafik();
goto tekrar; }
if (kay==27)
menu();
}//10
}//4
}
void cark(){
float i,j,a,t,x=0,k,m,d=0;
char kar[26]={'A','B','C','€','D','E','F','G','H','˜','J','K','L','M','N','O','™','P','R','S','T','U','š','V','Y','Z'};
char ch;
int r[16];
while(d<4){
setcolor(0);
for(k=0;k<16;k++)
r[k]=k;
srand(time(0));
for(t=0;t<rand()%100;t++){
a=0;
circle(450,155,120);
for(i=22.5;i<361;i=i+22.5){
delay(d);
setfillstyle(1,2);
setfillstyle(1,r[a]);
pieslice(450,155,j,i,120);
j=i; a=a+1;
for(k=1;k<5;k=k+2){
setfillstyle(2,7);
bar(280,100,330,140);
setfillstyle(1,4);
pieslice(320-2*k,130-2*k,145+5*k,175+5*k,30);
for(k=1;k<5;k=k+2){
setfillstyle(2,7);
bar(280,100,330,140);
setfillstyle(1,4);
pieslice(320+2*k,130+2*k,145-5*k,175-5*k,30);}
}
}
sound(500); delay(100); nosound();
m=r[15];
for(x=15;x>0;x--)
r[x]=r[x-1];
r[0]=m; d=d+1;
}
}//while
sound(1000); delay(150); nosound();
setcolor(4); settextstyle(1,0,2);
outtextxy(10,370,"Harf girin...:");
setcolor(7);
a=rand()%16;
bar(545,25,620,45);
settextstyle(1,0,2);
outtextxy(553,23,p[a]);
if (0==strcmp(p[a],"iflas")){
setcolor(4);
settextstyle(7,0,3);
outtextxy(100,250,"-IFLAS GELDI KAYBETTINIZ-");
getch();
grafik();}
q=atoi(p[a]);
ch=getch();
switch(ch){//7
case '”':ch='™';
case 'Ÿ':ch='';
case '‡':ch='€';
case '':ch='š';
case 'i':ch='˜';
case '':ch='I';
case '§':ch='¦';
}//7
ch=toupper(ch);
for (i=0;i<26;i++){//8
if(ch==kar[i]){//9
setfillstyle(1,4);
bar(22*i+3,400,22*i+23,420);
}//9
}//8
sound(1000); delay(150); nosound();
setfillstyle(7,1);
bar(5,370,150,399);
if (u==0){
srand(time(0));
y=rand()%19;
u=u+1;
FILE *fp;
fp=fopen("kelime.dat","r+");
if(fp==NULL){
printf("dosya yoktu yeni dosya olusturuldu..!!!\n\a");
fp=fopen("kelime.dat","w+");}
for(a=0;a<strlen(bul[y]);a++){
fseek(fp,0L,2);
fwrite(&bul[y][a],sizeof(char),1,fp);}
fclose(fp);
}
settextstyle(2,0,7);
for(i=0;i<strlen(bul[y]);i++)
outtextxy(50+i*30,300,"_");
char *n;
char s[1];
int h=0;
for (a=0;a<strlen(bul[y]);a++)
if (ch==bul[y][a]){
setfillstyle(1,15); setcolor(4); settextstyle(2,0,7);
h=h+1;
bar(50+a*30-5,300-5,50+a*30+10,320);
n=strset(s,ch);
outtextxy(50+a*30,300,n);
puan=puan+h*q;
}
char str[25];
int sig = 5;
gcvt(puan, sig, str);
bar(90,140,190,170);
settextstyle(1,0,3);
outtextxy(25,110,"-Toplam Puaniniz-");
outtextxy(115,140,str);
}
void main()
{//1
int surucu=DETECT, modu, hata,i;
initgraph(&surucu,&modu,"c:\\tc\\bgi");
hata=graphresult();
if (hata!=0)
{//2
printf("Grafik kullaniminda hata olmustur.\n");
printf("Hata : %s\n",grapherrormsg(hata));
printf("Program sonlandirilacaktir.\n");
getch();
exit(1);
}//2
menu();
}//1
void menu()
{ int i;
char ch;
cleardevice();
setbkcolor(0);
setcolor(15);
for(;;){
float i,j,a,t,x=0,k,m,d=0;
int r[16];
while(d<4){
setcolor(6);
for(k=0;k<16;k++)
r[k]=k;
for(t=0;t<10;t++){
circle(450,155,120);
a=0;
for(i=22.5;i<361;i=i+22.5){
delay(d);
setfillstyle(1,r[a]);
pieslice(450,155,j,i,120);
j=i; a=a+1;
}
sound(500); delay(100); nosound();
m=r[15];
for(x=15;x>0;x--)
r[x]=r[x-1];
r[0]=m; d=d+1;
}
}//while
sound(1000); delay(150); nosound();
setcolor(2);
settextstyle(7,0,6);
outtextxy(20,50,"€ARKIFELEK 2006");
settextstyle(1,0,3);
outtextxy(100,180,"1)YENI OYUNCU");
outtextxy(100,205,"2)OYUN YUKLE");
outtextxy(100,230,"3)BILGI");
outtextxy(100,255,"4)CIKIS");
outtextxy(100,295," SECIMINIZ..:");
settextstyle(7,0,1);
outtextxy(412,448,"CARKIFELEK 2006");
settextstyle(1,0,3);
for (i=0;i<=407;i++)
putpixel(i,460,RED);
for (i=596;i<=640;i++)
putpixel(i,460,RED);
for(;;){
ch=getch();
switch(ch)
{
case '1':kayit();
case '2':yukle();
case '3':credit();
case '4':exit(1);
}
}
}
}
void kayit(){
clrscr;
cleardevice();
setbkcolor(1);
char sifre1[20],sifre2[20],isim[20];
int i,c;
settextstyle(1,0,1);
outtextxy(390,450,"Menu icin 'menu' yaziniz...");
printf("\n Kullanici adinizi belirleyiniz...:");
scanf("%s",&isim);
if(strcmp(isim,"menu")==0) menu();
FILE *fp;
fp=fopen("data.dat","r+");
if(fp==NULL){
printf("dosya yoktu yeni dosya olusturuldu..!!!\n\a");
fp=fopen("data.dat","w+");}//if
rewind(fp);
while(!feof(fp)){
fread(&kisi,sizeof(kullanici),1,fp);
c=strcmp(kisi.isim,isim);
if(0==c) {printf("\nBu kullanici adi kayitli baska belirleyin...<ENTER>\n");
sound(1000);
delay(500);
nosound();
getch();
kayit();}//if
}//while
printf("Sifrenizi belirleyin...:");
scanf("%s",&sifre1);
if(strcmp(sifre1,"menu")==0) menu();
printf("Sifre onayi...:");
scanf("%s",&sifre2);
if(strcmp(sifre2,"menu")==0) menu();
i=strcmp(sifre1,sifre2);
while(i!=0){
printf("yanlis giris tekrar deneyin..!!\n");
sound(1000);
delay(500);
nosound();
printf("sifrenizi belirleyin...:");
scanf("%s",&sifre1);
if(strcmp(sifre1,"menu")==0) menu();
printf("sifre onayi...:");
scanf("%s",&sifre2);
if(strcmp(sifre2,"menu")==0) menu();
i=strcmp(sifre1,sifre2);
}//while i
if (i==0){
strcpy(kisi.sifre,sifre1);
strcpy(kisi.isim,isim);
FILE *fp;
fp=fopen("data.dat","r+");
if(fp==NULL){
printf("dosya yoktu yeni dosya olusturuldu..!!!");
fp=fopen("data.dat","w+");}//if fp
fseek(fp,0L,2);
fwrite(&kisi,sizeof(kullanici),1,fp);
fclose(fp);
printf("...KAYIT BASARILI...\n");
}//if i
getch();
clrscr;
menu();
}//kayit
void yukle()
{
cleardevice();
setbkcolor(1);
char i[20],s[20];
int a,b,c=0;
settextstyle(1,0,1);
outtextxy(390,450,"Menu icin 'menu' yaziniz...");
while(1!=2){
if(c>0){ printf("KULLANICI ADI VE SIFRE UYUSMUYOR!\n");
sound(1000);
delay(300);
nosound();}
c=c+1;
printf("\nkullanici adi...:\n"); scanf("%s",&i);
if(strcmp(i,"menu")==0) menu();
printf("sifre...:\n"); scanf("%s",&s);
if(strcmp(s,"menu")==0) menu();
FILE *fp;
fp=fopen("data.dat","r+");
if(fp==NULL){
printf("dosya yoktu yeni dosya olusturuldu..!!!\n\a");
fp=fopen("data.dat","w+");}//if
rewind(fp);
while(!feof(fp)){
fread(&kisi,sizeof(kullanici),1,fp);
a=strcmp(kisi.isim,i);
b=strcmp(kisi.sifre,s);
if(0==a) {
if(0==b){
int q;
delay(500);
for (q=1;q<220;q++){
cleardevice();
settextstyle(1,0,4);
outtextxy(150,225,"...OYUN YUKLENIYOR...");
}
grafik();
}
}//if
}//while
fclose(fp);
}
}//yukle
void credit(){
cleardevice();
setcolor(2);
settextstyle(1,0,6);
outtextxy(275,20, "T.C.");
outtextxy(35,75,"KOCAELI UNIVERSITESI");
settextstyle(1,0,4);
outtextxy(130,130,"MUHENDISLIK FAKULTESI");
settextstyle(1,0,3);
outtextxy(180,180,"BILGISAYAR MUHENDISLIGI");
settextstyle(1,0,2);
outtextxy(295,250, "(II.”)");
outtextxy(255,275,"2005-2006");
outtextxy(282,300, "2.PROJE");
outtextxy(105,350,"PROGRAMI YAZAN.: HUSEYIN AHMET AKBEN");
getch();
menu();
}