Toplam 5 sonuçtan 1 ile 5 arasındakiler gösteriliyor.

Konu: bir kaç c++ kodu

  1. #1
    ASTSUBAY
    Üyelik tarihi
    Nov 2005
    Mesajlar
    768
    Forum Katkısı:
    0

    Standart bir kaç c++ kodu

    YILAN OYUNU


    # include <stdio.h>
    # include <conio.h>
    # include <dos.h>
    # include <string.h>
    # include <stdlib.h>

    int yilan[100][2];
    int yemx,yemy,yb;
    int tus;
    int i,j;
    int puan,hiz,toppuan;
    int secim;
    int durum=0;

    acilis()
    {
    clrscr();
    textcolor(4);
    gotoxy(23,5); cprintf("Ú");
    gotoxy(51,5); cprintf("¿");
    gotoxy(23,16); cprintf("À");
    gotoxy(51,16); cprintf("Ù");

    textcolor(10); gotoxy(26,8); cprintf("[1] Yavas Puan(5)");
    textcolor(10); gotoxy(26,9); cprintf("[2] Normal Puan(10)");
    textcolor(10); gotoxy(26,10); cprintf("[3] Hizli Puan(15)");
    textcolor(10); gotoxy(26,11); cprintf("[4] Cok Hizli Puan(20)");
    textcolor(10); gotoxy(26,12); cprintf("[5] Cikis");
    textcolor(2); gotoxy(26,14); cprintf("Seciminiz...: ");
    textcolor(7);
    secim=getch();
    switch(secim)
    {
    case '1': puan=5; hiz=200; break;
    case '2': puan=10; hiz=150; break;
    case '3': puan=15; hiz=100; break;
    case '4': puan=20; hiz=50; break;
    case '5': return 0; break;
    default : puan=5; hiz=200; break;
    }

    clrscr();
    textcolor(9); gotoxy(30,1); cprintf("441 EMRAH SIMSEK YILAN OYUNU");
    textcolor(4);
    gotoxy(5,2); cprintf("Ú");
    gotoxy(75,2); cprintf("¿");
    gotoxy(5,22); cprintf("À");
    gotoxy(75,22); cprintf("Ù");
    textcolor(7);
    for (i=6;i<=74;i++)
    {
    gotoxy(i,2); cprintf("Ä");
    gotoxy(i,22); cprintf("Ä");
    }
    for (i=3;i<=21;i++)
    {
    gotoxy(5,i);cprintf("³");
    gotoxy(75,i);cprintf("³");
    }
    yb=3;
    yilan[0][0]=10;
    yilan[1][0]=9;
    yilan[2][0]=8;

    yilan[0][1]=10;
    yilan[1][1]=10;
    yilan[2][1]=10;

    randomize();
    yemx=(rand()%50)+5;
    yemy=(rand()%10)+5;

    textcolor(7);
    for (i=0;i<yb;i++)
    {
    gotoxy(yilan[i][0],yilan[i][1]); cprintf("");
    }
    textcolor(2); gotoxy(yemx,yemy); cprintf("*");
    gotoxy(yilan[yb-1][0],yilan[yb-1][1]); printf(" ");
    }

    yem()
    {
    randomize();
    j=0;
    while(j==0)
    {
    yemx=(rand()%67)+6;
    yemy=(rand()%17)+3;
    for (i=0;i<yb;i++)
    {
    if (yemx!=yilan[i][0] && yemy!=yilan[i][1])
    j=1;
    textcolor(2); gotoxy(yemx,yemy); cprintf("*");
    }
    }
    }


    yilanciz()
    {
    textcolor(7);
    for (i=0;i<yb;i++)
    {
    gotoxy(yilan[i][0],yilan[i][1]); printf("");
    }
    gotoxy((yilan[yb-1][0]),(yilan[yb-1][1])); printf(" ");

    if (yilan[0][0]==yemx && yilan[0][1]==yemy)
    {
    yb=yb+1;
    toppuan=toppuan+puan;
    gotoxy(30,24); printf("PUAN...: %d ",toppuan);
    gotoxy((yilan[yb-1][0]),(yilan[yb-1][1])); printf("");
    gotoxy(30,24); printf("PUAN...: %d ",toppuan);
    yem();
    }
    if (yilan[0][1]==2 || yilan[0][1]==22 || yilan[0][0]==5 || yilan[0][0]==75)
    {
    gotoxy(30,25); printf("Oyun Bitti!"); durum=1;
    return 0;
    }

    for (i=1;i<yb;i++)
    {
    if(yilan[0][0]==yilan[i][0] && yilan[0][1]==yilan[i][1])
    {
    gotoxy(30,25); printf("Oyun Bitti!"); durum =1; return 0;
    }
    }
    }


    main()
    {
    acilis();
    tus=getch();
    while(tus!=27)
    {
    while(!kbhit() && durum==0)
    {
    if(tus==77) //sag
    {
    for (i=yb-1;i>0;i--)
    {
    yilan[i][0]=yilan[i-1][0];
    yilan[i][1]=yilan[i-1][1];
    }
    yilan[0][0]=yilan[0][0]+1;
    yilanciz();
    }

    if (tus==80) //asagi
    {
    for (i=yb-1;i>0;i--)
    {
    yilan[i][0]=yilan[i-1][0];
    yilan[i][1]=yilan[i-1][1];
    }
    yilan[0][1]=yilan[0][1]+1;
    yilanciz();
    }

    if (tus==72) //yukari
    {
    for (i=yb-1;i>0;i--)
    {
    yilan[i][0]=yilan[i-1][0];
    yilan[i][1]=yilan[i-1][1];
    }
    yilan[0][1]=yilan[0][1]-1;
    yilanciz();
    }

    if (tus==75) //sol
    {
    for (i=yb-1;i>0;i--)
    {
    yilan[i][0]=yilan[i-1][0];
    yilan[i][1]=yilan[i-1][1];
    }
    yilan[0][0]=yilan[0][0]-1;
    yilanciz();
    }
    if (durum==1)
    {
    getch();
    return 0;
    }
    delay(hiz);
    }
    tus=getch();
    }

    getch();
    }

  2. #2
    ACEMİ ER
    Üyelik tarihi
    Jun 2006
    Mesajlar
    16
    Forum Katkısı:
    0

    Standart bir kaç c++ kodu

    slm şahin. kod &#231;alışmıyor.neden olabilir?

  3. #3
    ACEMİ ER
    Üyelik tarihi
    Nov 2005
    Mesajlar
    6
    Forum Katkısı:
    0

    Standart Ynt: bir kaç c++ kodu

    Çalışmaz çünkü #include lerden sonra libraryler eksik. Ayrıca compiler türkçe. Diğer compiler'larda çalişmaz. Programi yazan kişi türkçe compiler kullaniyormuş.

  4. #4

    Standart bir kaç c++ kodu

    ya ben araştırdım bulamadım Türkçe Compiler helal olsun adama

  5. #5
    ÇAVUŞ
    Üyelik tarihi
    Dec 2005
    Mesajlar
    331
    Forum Katkısı:
    0

    Standart bir kaç c++ kodu

    Kod yanlış yazılmışşşş
    Vatan namustur, Vatan şereftir,
    Vatan korunacak tek hedeftir.
    Vatan sevdadır, Vatan aşktır,
    Vatan için fedakarlık bir başkadır.
    Vatan candır, Vatan kandır,
    Vatana sahip çıkmak imandandır.
    [URL=http://imageshack.us][IMG]http://img103.imageshack.us/img103/8016/kurantp1.gif[/IMG][/URL]

Konu Bilgisi

Users Browsing this Thread

Şu anda 1 üyemiz bu konuya göz atıyor. (0 kayıtlı üye ve 1 misafir.)

Bu Konuyu Paylaşın !

Bu Konuyu Paylaşın !

Yetkileriniz

  • Konu Acma Yetkiniz Yok
  • Cevap Yazma Yetkiniz Yok
  • Eklenti Yükleme Yetkiniz Yok
  • Mesajınızı Değiştirme Yetkiniz Yok
  •  
Garantili SEO - Moradam