hoSSohbeT.com  Sohbet  forumlari

Anasayfa Bugünki Mesajlar Forumları Okundu Kabul Et
Geri git   hoSSohbeT.com Sohbet forumlari > Bilgisayar ve İnternet Dünyası > Bilgisayar - İnternet > Bilgisayar Dünyası > Programlama > C ve C++
Kayıt ol Yardım Sohbet Gazete oku Diyetsaglik Üye Listesi Ajanda Arama Bugünki Mesajlar Forumları Okundu Kabul Et



Cevapla
 
LinkBack Seçenekler Stil
Alt 04-09-08, 17:07   #1
Dokunma Yanarsın
 
aLayıNaiSyaN - ait Kullanıcı Resmi (Avatar)
 
Üyelik tarihi: 04-02-08
Nerden: . . .
Mesajlar: 1,981
Tecrübe Puanı: 496 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000
C++ Örnek Kodlar

5 ogrenci, 5 tane de top var.Bu ogrencilerden her biri bir topu sececek daha sonra da kimin hangi topu sectigi ekrana yazdiralacak.

Bazi arkadaslar bunda ne varki diyebilir ama ben bu ornegin onemli oldugunu dusunuyorum cunku programin icinde farkli ogrenciler ayni topu secemiyorlar.Onemli kisim burasi zaten...

PHP- Kodu:
#include <stdio.h>
#include <conio.h>
 
int main()
{
int i;
int ogr[5] = {0};
int top[6] = {0};
int secenek;
 
    for(
05i++)
    {
 
                
printf("%d. ogrenci hangi topu sececeksin? ",1);
                
scanf("%d",&secenek);
 
                while(
secenek <= || secenek 5){
                
printf("1-5 arasinda bir sayi gir ");
                
scanf("%d",&secenek);
                }
 
                if(
top[secenek] != 0)
                {
                                do{
                                     
printf("Yeniden gir ");
                                     
scanf("%d",&secenek);
 
                                     while(
secenek <= || secenek 5){
                                     
printf("1-5 arasinda bir sayi gir ");
                                     
scanf("%d",&secenek);
                                     }
 
                                     }while(
top[secenek] != 0);
 
                }
                
top[secenek] = 1;
                
ogr[i] = secenek;
 
 
 
    }
 
 
 
for(
1;<= 5i++)
{
  
printf("%d. ogrencinin sectigi top %d numarali toptur.\n",i,ogr[1]);
}
 
getch();
 
return 
0;
 

__________________
aLL Hope iS Gone

aLayıNaiSyaN isimli Üye şimdilik offline konumundadır  
Digg this Post!Bookmark Post in Technorati
Alıntı ile Cevapla
Alt 04-09-08, 17:08   #2
Dokunma Yanarsın
 
aLayıNaiSyaN - ait Kullanıcı Resmi (Avatar)
 
Üyelik tarihi: 04-02-08
Nerden: . . .
Mesajlar: 1,981
Tecrübe Puanı: 496 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000
Cevap: C++ Örnek Kodlar

Basit bir eğitim programı.(ilkokul çocukları için)Program öğrenci hesaplamaları yaparken yanlış yada doğru durumuna göre öğrenciyle sohbet içinde kalıyo.. 1. seviye için 1 basamaklı sayılarla 2. seviye için 2 basamaklı sayılarla işlem yapılıyo...
PHP- Kodu:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
 
int sayac=1,basari=0,sayi,seviye;   // Global Değişkenler..
 
int seviye_sec(void);
 
int islem_sec(void);
 
void islem_arti(int,int);
 
void islem_eksi(int,int);
 
void islem_carpi(int,int);
 
void islem_bolu(int,int);
 
 
int main(void)
 
{
 
    
char devam_mi;
 
    
int rasgele_sayi_1,rasgele_sayi_2,islem;
 
    
srand(time(NULL));
 
    do {
          
seviye seviye_sec();
 
          
printf("\n");
 
          
islem islem_sec();
 
          
printf("\n");
 
          if(
seviye==1) {
 
             
rasgele_sayi_1 1+rand()%10;
             
rasgele_sayi_2 1+rand()%10;
 
             switch(
islem) {
 
                case 
1:
                    
islem_arti(rasgele_sayi_1,rasgele_sayi_2);
                    break;
 
                case 
2:
                    
islem_eksi(rasgele_sayi_1,rasgele_sayi_2);
                    break;
 
                case 
3:
                    
islem_carpi(rasgele_sayi_1,rasgele_sayi_2);
                    break;
 
                case 
4:
                    
islem_bolu(rasgele_sayi_1,rasgele_sayi_2);
                    break;
 
                    }
 
                       }
 
          else {
 
             
rasgele_sayi_1 10+rand()%90;
             
rasgele_sayi_2 10+rand()%90;
 
             switch(
islem) {
 
                case 
1:
                    
islem_arti(rasgele_sayi_1,rasgele_sayi_2);
                    break;
 
                case 
2:
                    
islem_eksi(rasgele_sayi_1,rasgele_sayi_2);
                    break;
 
                case 
3:
                    
islem_carpi(rasgele_sayi_1,rasgele_sayi_2);
                    break;
 
                case 
4:
                    
islem_bolu(rasgele_sayi_1,rasgele_sayi_2);
                    break;
 
                    }
 
                       }
 
          
printf("\n");
 
          
printf("Devam Etmek İstermisiniz?..(e,h)=..");
          
devam_mi=getche();
 
          
printf("\n\n");
 
          
sayac=1;
          
basari=0;
 
          }while(
devam_mi=='e');
 
 
          
printf("Programimizi Kullandiginiz Icin Tesekkurler..\n");
 
          
printf("Hoscakalin...");
 
          
getch();return 0;
}
 
int seviye_sec(void)
 
{  
 
     
printf("BIR BASAMAKLI ISLEMLER ICIN \"1\"E...\n");
 
     
printf("IKI BASAMAKLI ISLEMLER ICIN \"2\"E BASINIZ...\n");
 
 
     
printf("LUTFEN SECENEGINIZI GIRINIZ...");
     
scanf("%d",&seviye);
 
 
     return 
seviye;
}
 
int islem_sec(void)
 
{
    
int islem;
 
    
printf("TOPLAMA ICIN \"1\"E...\n");
 
    
printf("CIKARMA ICIN \"2\"E...\n");
 
    
printf("CARPMA ICIN  \"3\"E...\n");
 
    
printf("BOLME ICIN   \"4\"E BASINIZ...\n");
 
    
printf("LUTFEN SECENEGINIZI GIRINIZ...");
    
scanf("%d",&islem);
 
    return 
islem;
}
 
void islem_arti(int rasgele_1,int rasgele_2)
 
{
     
printf("%d arti %d kac eder?..",rasgele_1,rasgele_2);
     
scanf("%d",&sayi);
 
     do {
 
        if(
sayi==(rasgele_1 rasgele_2)) {
 
           switch(
sayac) {
 
              case 
1:
                  
printf("Mukemmelsin");
                  break;
 
              case 
2:
                  
printf("Cok Guzel");
                  break;
 
              case 
3:
                  
printf("Aferin");
                  break;
 
              default:
                  
printf("Boyle Devam Et");
                  break;
 
                     }
 
            
basari=1;
                                                   }
 
         else {
 
            switch(
sayac) {
 
               case 
1:
                   
printf("Hayir Lutfen Tekrar Dene...");
                   break;
 
               case 
2:
                   
printf("Yanlis.Lutfen Tekrar Dene...");
                   break;
 
               case 
3:
                   
printf("Hayir.Denemeye Devam...");
                   break;
 
               default:
                   
printf("Pes Etmeyin...");
                   break;
 
                          }
 
               
scanf("%d",&sayi);
 
                               }
          
sayac++;
 
          }while(
basari!=1);
 
}
 
void islem_eksi(int rasgele_1,int rasgele_2)
 
{
     
printf("%d eksi %d kac eder?..",rasgele_1,rasgele_2);
     
scanf("%d",&sayi);
 
     do {
 
      if(
sayi==(rasgele_1 rasgele_2)) {
 
           switch(
sayac) {
 
              case 
1:
                  
printf("Mukemmelsin");
                  break;
 
              case 
2:
                  
printf("Cok Guzel");
                  break;
 
              case 
3:
                  
printf("Aferin");
                  break;
 
              default:
                  
printf("Boyle Devam Et");
                  break;
 
                     }
 
            
basari=1;
                                                   }
 
        else {
 
            switch(
sayac) {
 
               case 
1:
                   
printf("Hayir Lutfen Tekrar Dene...");
                   break;
 
               case 
2:
                   
printf("Yanlis.Lutfen Tekrar Dene...");
                   break;
 
               case 
3:
                   
printf("Hayir.Denemeye Devam...");
                   break;
 
               default:
                   
printf("Pes Etmeyin...");
                   break;
 
                          }
 
         
scanf("%d",&sayi);
 
                               }
         
sayac++;  
 
         }while(
basari!=1);
 
}
 
void islem_carpi(int rasgele_1,int rasgele_2)
 

 
 
     
printf("%d carpi %d kac eder?..",rasgele_1,rasgele_2);
     
scanf("%d",&sayi);
 
     do {
 
      if(
sayi==(rasgele_1 rasgele_2)) {
 
           switch(
sayac) {
 
              case 
1:
                  
printf("Mukemmelsin");
                  break;
 
              case 
2:
                  
printf("Cok Guzel");
                  break;
 
              case 
3:
                  
printf("Aferin");
                  break;
 
              default:
                  
printf("Boyle Devam Et");
                  break;
 
                     }
 
            
basari=1;
                                                   }
 
        else {
 
            switch(
sayac) {
 
               case 
1:
                   
printf("Hayir Lutfen Tekrar Dene...");
                   break;
 
               case 
2:
                   
printf("Yanlis.Lutfen Tekrar Dene...");
                   break;
 
               case 
3:
                   
printf("Hayir.Denemeye Devam...");
                   break;
 
               default:
                   
printf("Pes Etmeyin...");
                   break;
 
                          }
 
         
scanf("%d",&sayi);
 
                               }
         
sayac++;  
 
         }while(
basari!=1);
 
}
 
void islem_bolu(int rasgele_1,int rasgele_2)
 
{
 
     if(
rasgele_1%rasgele_2!=0) {
 
        if(
seviye==1) {
 
          do {  
            
rasgele_1 rand()%9;
            
rasgele_2 rand()%9;
            }while(
rasgele_1%rasgele_2!=0);
 
              }
 
        else {
 
          do {
              
rasgele_1 10+rand()%90;
              
rasgele_2 10+rand()%90;
              }while(
rasgele_1%rasgele_2!=0);
 
              }
 
        }
 
 
     
printf("%d bolu %d kac eder?..",rasgele_1,rasgele_2);
     
scanf("%d",&sayi);
 
     do {
 
      if(
sayi==(rasgele_1 rasgele_2)) {
 
           switch(
sayac) {
 
              case 
1:
                  
printf("Mukemmelsin");
                  break;
 
              case 
2:
                  
printf("Cok Guzel");
                  break;
 
              case 
3:
                  
printf("Aferin");
                  break;
 
              default:
                  
printf("Boyle Devam Et");
                  break;
 
                     }
 
            
basari=1;
                                                   }
 
        else {
 
            switch(
sayac) {
 
               case 
1:
                   
printf("Hayir Lutfen Tekrar Dene...");
                   break;
 
               case 
2:
                   
printf("Yanlis.Lutfen Tekrar Dene...");
                   break;
 
               case 
3:
                   
printf("Hayir.Denemeye Devam...");
                   break;
 
               default:
                   
printf("Pes Etmeyin...");
                   break;
 
                          }
 
         
scanf("%d",&sayi);
 
                               }
         
sayac++;  
 
         }while(
basari!=1);
 

aLayıNaiSyaN isimli Üye şimdilik offline konumundadır  
Digg this Post!Bookmark Post in Technorati
Alıntı ile Cevapla
Alt 04-09-08, 17:09   #3
Dokunma Yanarsın
 
aLayıNaiSyaN - ait Kullanıcı Resmi (Avatar)
 
Üyelik tarihi: 04-02-08
Nerden: . . .
Mesajlar: 1,981
Tecrübe Puanı: 496 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000
Cevap: C++ Örnek Kodlar

]===Mahkum Problemi===
Problem şu ;
bir masanın etrafında 21 tane mahkum vardır..
1. mahkumdan başlamak üzere 1. mahkumdan sonra gelen hayatta olan ilk 2 mahkumdan 2.si ölecek daha sonra o ölen mahkumdan sonra gelen ilk hayatta olan mahkumdan sonraki ilk 2 mahkumdan 2. ölecek ve bu böyle devam edecek ta ki hayatta 1 kişi kalana kadar,hayatta kalan mahkum hangisidir?

PHP- Kodu:
#include<stdio.h>
#include<conio.h>
 
main()
{
      
int A[21]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; //Mahkumların hepsine 1 degeri verdim,yaşadıklarını belirtmek için.
      
int i,j,n,sayac,x;
      
i=0// 1. mahkumdan başlandığı için i=0 başlangıç değeri verdim.
      
while(1) { sayac=0;x=0;n=i+1;
       while(
1){ if(n>20n=0;
                 if(
A[n]==1sayac++; //Hayatta olan mahkumdan sonraki hayatta olan ilk iki mahkumu bulmak icin,
                 
if(sayac==2) break;  //sonsuz döngü açtım,bu ilk iki mahkumdan ikincisine ulaştığımda döngüyü kırdım,
                 
n++;                 //çünkü ölücek olan ikinci mahkum olacak,
                
}
        
A[n]=0;//döngüyü kırdıktan sonra o makuma 0 değeri vererek öldürdüm.
 
        
while(1) { n++;                      //öldürdüğüm mahkumdan sonra gelen ilk hayattaki mahkumu bulmak için,
                   
if(n>20n=0;             //yine sonsuz bir döngü açtım,çünkü bi yerden sonra ölü mahkumdan sonra gelen,
                   
if(A[n]==1) {i=n;break;}  // mahkumda ölü olabilir,yani 18.=0,19.=0 olabilirdi.
                  
}
        for(
j=0;j<21;j++) { if(A[j]==1x++;} // for döngüsüyle hayatta kalan tek 1 kişi olup olmadığını kontrol ettim,
        
if(x==1) break;                       //eğer 1 kişi kalmışsa en baştaki sonsuz döngüyü kırıp çıktım..
                
}
        for(
j=0;j<21;j++) {if(A[j]==1) { printf("%d",j+1);break;} // son olarak hayatta olan kişiyi indis numarısıyla buldum..
                                                                   //indis numarasını 1 arttırım çünkü A[0] 1. kişiyi temsil ediyo aslında.
                          

 
 
        
getch();return 0;

aLayıNaiSyaN isimli Üye şimdilik offline konumundadır  
Digg this Post!Bookmark Post in Technorati
Alıntı ile Cevapla
Alt 04-09-08, 17:10   #4
Dokunma Yanarsın
 
aLayıNaiSyaN - ait Kullanıcı Resmi (Avatar)
 
Üyelik tarihi: 04-02-08
Nerden: . . .
Mesajlar: 1,981
Tecrübe Puanı: 496 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000
Cevap: C++ Örnek Kodlar

]
PHP- Kodu:
#include<stdio.h>#include<conio.h>
#include<math.h>
#include<graphics.h>
main(){
int gd=DETECT,gm,a;
detectgraph(&gd,&gm);
initgraph(&gd,&gm,"c:\\tc\\bgi\\");
 
for(
a=0;a<570;a++){
delay(7);
 
cleardevice();
setcolor(a);
circle(150+a,150,70);
}
 
 
 
getch();
 

aLayıNaiSyaN isimli Üye şimdilik offline konumundadır  
Digg this Post!Bookmark Post in Technorati
Alıntı ile Cevapla
Alt 04-09-08, 17:10   #5
Dokunma Yanarsın
 
aLayıNaiSyaN - ait Kullanıcı Resmi (Avatar)
 
Üyelik tarihi: 04-02-08
Nerden: . . .
Mesajlar: 1,981
Tecrübe Puanı: 496 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000
Cevap: C++ Örnek Kodlar

]==8 Vezir Problemi==
Problem şu;8 vezir bir satranç tahtasına birbirlerini yemeyecek durumda,kaç farklı şekilde yerleştirilebilir.Programda kaba kuvvet yaklaşımını kullandım.Program çalışmaya başladıktan sonra her satırda yan yana 8sayı görüceksiniz bu sayılardan 1.si,satranç tahtasında 1. satırda bulunan vezirin sütun numarası,2.sayı 2. satırda bulunan vezirin sütun numarası..bu şekilde.Ayrıca programın sonunda da kaç ihtimal olabileceğini göreceksiniz.

PHP- Kodu:
#include<stdio.h>
#include<conio.h>
void eleman_sifirla(int *);
int kontrol_a(int [][8],int);
int kontrol_b(int [][8],int);
int kontrol_c(int [][8],int);
int kontrol_d(int [][8],int);
int kontrol_e(int [][8],int);
int kontrol_f(int [][8],int);
int kontrol_g(int [][8],int);
 
int main(void)
{
 
    
int a,b,c,d,e,f,g,h,bulunan=0;
    
int tahta[8][8]={0};
 
 
 
    for(
a=0;a<=7;a++){
 
     for(
b=0;b<=7;b++){
 
       if(
b==a)
         continue;
 
       for(
c=0;c<=7;c++){
 
          if(
c==a||c==b)
            continue;
 
          for(
d=0;d<=7;d++){
 
             if(
d==a||d==b||d==c)
               continue;
 
              for(
e=0;e<=7;e++){
 
                 if(
e==a||e==b||e==c||e==d)
                    continue;
 
                  for(
f=0;f<=7;f++){
 
                     if(
f==a||f==b||f==c||f==d||f==e)
                        continue;
 
                       for(
g=0;g<=7;g++){
 
                          if(
g==a||g==b||g==c||g==d||g==e||g==f)
                             continue;
 
                            for(
h=0;h<=7;h++){
 
                               if(
h==a||h==b||h==c||h==d||h==e||h==f||h==g)
                                   continue;
 
             
tahta[0][a]=1;
             
tahta[1][b]=1;
             
tahta[2][c]=1;
             
tahta[3][d]=1;
             
tahta[4][e]=1;
             
tahta[5][f]=1;
             
tahta[6][g]=1;
             
tahta[7][h]=1;
 
             if(
kontrol_a(tahta,a)){
               
eleman_sifirla(tahta[0]);
               continue;
               }
 
             if(
kontrol_b(tahta,b)){
               
eleman_sifirla(tahta[0]);
               continue;
               }
 
             if(
kontrol_c(tahta,c)){
               
eleman_sifirla(tahta[0]);
               continue;
               }
 
             if(
kontrol_d(tahta,d)){
               
eleman_sifirla(tahta[0]);
               continue;
               }
 
             if(
kontrol_e(tahta,e)){
               
eleman_sifirla(tahta[0]);
               continue;
               }
 
             if(
kontrol_f(tahta,f)){
               
eleman_sifirla(tahta[0]);
               continue;
               }
 
             if(
kontrol_g(tahta,g)){
               
eleman_sifirla(tahta[0]);
               continue;
               }
 
 
             
printf("A%d B%d C%d D%d E%d F%d G%d H%d\n",a+1,b+1,c+1,d+1,e+1,f+1,g+1,h+1);
             
printf("-----------------------\n");
             
bulunan++;
             }
//h sonu
             
}//g sonu
             
}//f sonu
             
}//e sonu
             
}//d sonu
             
}// c sonu
             
}//b sonu
             
}//a sonu
 
      
printf("İslem Bitmistir Toplam %d iHtimal Vardir...",bulunan);
      
getch();
      return 
0;
}
 
int kontrol_a(int tahta[][8],int a)
{
    
int j,k,z,w;
 
    
j=1;
    
k=a+1;
 
    while(
j<=7&&k<=7){
 
      if(
tahta[j][k]==1)
        return 
1;
 
       
j++;
       
k++;
       }
 
    
z=a-1;
    
w=1;
 
    while(
z>=0&&w<=7){
 
       if(
tahta[w][z]==1)
         return 
1;
 
       
w++;
       
z--;
        }
 
     return 
0;
}
 
 
int kontrol_b(int tahta[][8],int b)
{
    
int j,k,z,w;
 
    
j=2;
    
k=b+1;
 
    while(
j<=7&&k<=7){
 
      if(
tahta[j][k]==1)
        return 
1;
 
       
j++;
       
k++;
       }
 
    
z=b-1;
    
w=2;
 
    while(
z>=0&&w<=7){
 
       if(
tahta[w][z]==1)
         return 
1;
 
       
w++;
       
z--;
        }
 
     return 
0;
}
 
 
int kontrol_c(int tahta[][8],int c)
{
    
int j,k,z,w;
 
    
j=3;
    
k=c+1;
 
    while(
j<=7&&k<=7){
 
      if(
tahta[j][k]==1)
        return 
1;
 
       
j++;
       
k++;
       }
 
    
z=c-1;
    
w=3;
 
    while(
z>=0&&w<=7){
 
       if(
tahta[w][z]==1)
         return 
1;
 
       
w++;
       
z--;
        }
 
     return 
0;
}
 
int kontrol_d(int tahta[][8],int d)
{
    
int j,k,z,w;
 
 
    
j=4;
    
k=d+1;
 
    while(
j<=7&&k<=7){
 
      if(
tahta[j][k]==1)
        return 
1;
 
       
j++;
       
k++;
       }
 
    
z=d-1;
    
w=4;
 
    while(
z>=0&&w<=7){
 
       if(
tahta[w][z]==1)
         return 
1;
 
       
w++;
       
z--;
        }
 
     return 
0;
}
 
int kontrol_e(int tahta[][8],int e)
{
    
int j,k,z,w;
 
    
j=5;
    
k=e+1;
 
    while(
j<=7&&k<=7){
 
      if(
tahta[j][k]==1)
        return 
1;
 
       
j++;
       
k++;
       }
 
    
z=e-1;
    
w=5;
 
    while(
z>=0&&w<=7){
 
       if(
tahta[w][z]==1)
         return 
1;
 
       
w++;
       
z--;
        }
 
     return 
0;
}
 
 
int kontrol_f(int tahta[][8],int f)
{
    
int j,k,z,w;
 
    
j=6;
    
k=f+1;
 
    while(
j<=7&&k<=7){
 
      if(
tahta[j][k]==1)
        return 
1;
 
       
j++;
       
k++;
       }
 
    
z=f-1;
    
w=6;
 
    while(
z>=0&&w<=7){
 
       if(
tahta[w][z]==1)
         return 
1;
 
       
w++;
       
z--;
        }
 
     return 
0;
}
 
int kontrol_g(int tahta[][8],int g)
{
    
int j,k,z,w;
 
    
j=7;
    
k=g+1;
 
    while(
j<=7&&k<=7){
 
      if(
tahta[j][k]==1)
        return 
1;
 
       
j++;
       
k++;
       }
 
    
z=g-1;
    
w=7;
 
    while(
z>=0&&w<=7){
 
       if(
tahta[w][z]==1)
         return 
1;
 
       
w++;
       
z--;
        }
 
     return 
0;
}
 
void eleman_sifirla(int *ptr)
{
     
int i;
 
   for(
i=0;i<=63;i++)
     
ptr[i]=0;

aLayıNaiSyaN isimli Üye şimdilik offline konumundadır  
Digg this Post!Bookmark Post in Technorati
Alıntı ile Cevapla
Alt 04-09-08, 17:11   #6
Dokunma Yanarsın
 
aLayıNaiSyaN - ait Kullanıcı Resmi (Avatar)
 
Üyelik tarihi: 04-02-08
Nerden: . . .
Mesajlar: 1,981
Tecrübe Puanı: 496 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000
Cevap: C++ Örnek Kodlar

küçük bir stok programı

PHP- Kodu:
# include <stdio.h>
# include <conio.h>
 
char malinadi[10] [25];
char adedi[10] [10];
char fiyati[30] [20];
 
int a;
main()
{
for(
a=0;a<6;a++)
clrscr();
printf("%d.malinadi:",a+1);gets (malinadi[a]);
printf("%d.adedi:",a+1);gets(adedi[a]);
printf("%d.fiyati:",a+1);gets(fiyati[a]);
clrscr();
printf("sirano malin adi adedi fiyati\n");
printf("------ ------- ---------- ---------\n");
for(
a=0;a<6;a++) {
printf (" %d %-15s %-20s %-45s\n"a,malinadi[a],adedi[a],fiyati[a]);
}
getch();

aLayıNaiSyaN isimli Üye şimdilik offline konumundadır  
Digg this Post!Bookmark Post in Technorati
Alıntı ile Cevapla
Alt 04-09-08, 17:12   #7
Dokunma Yanarsın
 
aLayıNaiSyaN - ait Kullanıcı Resmi (Avatar)
 
Üyelik tarihi: 04-02-08
Nerden: . . .
Mesajlar: 1,981
Tecrübe Puanı: 496 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000
Cevap: C++ Örnek Kodlar

]++ net yazılar ve örnek kodlar

PHP- Kodu:
#include <iomanip>
#include <iostream>
#include <cstring>
using namespace std;
 
class 
Integerset
{
private :
int *set;
int len;
public: 
Integerset();
Integerset(int arr[],int x);
~
Integerset();
Integerset Unionofsets(Integerset &,Integerset &,Integerset &);
Integerset Intersection(Integerset &,Integerset &,Integerset &);
 
int memberof(int);
void Insertelem(int,int);
 
void DeleteElem(int);
 
int Equal(Integerset &,Integerset &);
void Display();
void operator =(const Integerset &);
 
};
 
 
 
 
 
 
 
//////////////////////// D-E-F-A-U-L-T //////////////////////////////
Integerset ::Integerset()
{
len=10;
set=new int[len];
for(
int i=0;i<len;i++)
set[i]=-1;
}
/////////////// C-O-N-S-T-R-U-C-T-O-R /////////////////////// 
Integerset ::Integerset(int arr[],int x)
{
set=new int[x];
len=x;
for(
int i=0;i<x;i++)
set[i]=arr[i];
}
//////////////// D-E-S-T-R-U-C-T-O-R ///////////////////////
Integerset ::~Integerset()
{
 
delete[] set;
}
////////////// C-O-P-Y ///////////////
void Integerset erator =(const Integerset ob)
{
for(
int i=0;i<ob.len;i++)
set[i]=ob.set[i];
}
////////////////// U-N-I-O-N-S-E-T /////////////////
 
Integerset Integerset ::Unionofsets(Integerset &obj1,Integerset &obj2,Integerset &obj3)
{
 
 
 
for(
int i=0;i<len;i++)
obj1.set[i]=obj3.set[i];
int t=0;
int k=obj3.len;
 
int n=0;
 
for(
i=k;i<k+obj2.len;i++)

for(
int j=0;j<obj3.len;j++)
{
if(
obj2.set[n]!=obj3.set[j])
t=1;
else 
{
t=0;
break;
}
}
if(
t==1)

obj1.set[i]=obj2.set[n];
++
n;
}
if(
t==0)

 
n++;
}
t=0;
}
return 
obj1;
}
 
//////////////// I-N-T-E-R-S-E-C-T-I-O-N //////////////////
Integerset Integerset ::Intersection(Integerset &obj1,Integerset &obj2,Integerset &obj3)
{
for(
int i=0;i<obj3.len;i++)
obj3.set[i]=-1;
 
int t=0;
int n=0
for(
i=0;i<obj1.len;i++)
t=0;
for(
int j=0;j<obj2.len;j++)
{
if(
obj1.set[i]==obj2.set[j])
t=1;
break;
}
else 
t=0;
}
if(
t==1)
{
obj3.set[n]=obj1.set[i];
n++;
}
 
}
return 
obj3;
}
 
/////////////////// D-I-S-P-L-A-Y ///////////////////////////
 
void Integerset :isplay()
{
cout<<"{";
for(
int j=0;j<len;j++)
{ if(*(
set+j)!=-1)
{ if(*(
set+j)!=*(set+(j+1)))
{ if(
j+1==len||j+1==8
cout<<*(set+j);
else 
cout<<*(set+j)<<",";

}
 
}
cout<<"}"<<endl;
}
/////////////////// M-E-M-B-E-R O-F ///////////////////////
int Integerset ::memberof(int a)
{
int t=0;
for(
int i=0;i<len;i++)
{ if(
set[i]==a)
t=1
}
if(
t==1)
return 
1;
else 
return 
0;
}
/////////////////// I-N-S-E-R-T - E-L-E-M-E-N-T ///////////////////////
void Integerset ::Insertelem(int a,int loc)
{
 
 
int t=0;
for(
int i=0;i<len;i++)
{ if(
set[i]==a)
t=1
}
if(
t==1)
cout<<"the number is in the set "<<endl;
else
{if(
loc>len)
cout<<"the location out of size"<<endl;
else
set[loc]=a;
}
 
}
/// D-E-L-E-T-E - E-L-E-M-E-N-T ///
void Integerset :eleteElem(int a)
{
int t=0
for(
int i=0;i<len;i++)
{ if(
set[i]==a)

set[i]=-1;
t=1;
}
}
if(
t==1)
cout<<" the number "<<a<<" deleted "<<endl;
else 
cout<<"the number cannot found in the set"<<endl;
}
 
 
//// E-Q-U-A-L ////
int Integerset::Equal(Integerset obj1,Integersetobj2)
{
int t=0;
for(
int i=0;i<obj1.len;i++)
{ for(
int j=0;j<obj2.len;j++)
{ if(
obj1.set[i]==obj2.set[j])

t=1;
break;

else
{
t=0;
}
}
if(
t==0)
break;

if(
t==1)
return 
1;
else
return 
0;
}
 
///////////////////////////////////////////////////////////////////////////////////
////////// *** M-A-I-N *** ////////////
///////////////////////////////////////////////////////////////////////////////////
int main()

 
int a[4]={1,2,3},m,k;
int b[4]={7,2,8,6};
int c[5]={3,4,5,6,7};
Integerset s1(a,3);
Integerset s2(b,4);
Integerset s3(c,5);
 
 
Integerset s9,s10;
Integerset set1,set2;
Integerset s4,s5,s6;
Integerset s11(a,3),st4,st5,st6;
Integerset s22(b,4);
Integerset s33(c,5);
Integerset s;
 
///////////// PRINT three SETS ////////////// 
cout<<" 1-first set : "
s1.Display(); 
cout<<endl
cout<<" 2-second set : "
s2.Display(); 
cout<<endl
cout<<" 3-third set : "
s3.Display(); 
/////////////////////////////////////////////////////////////////////////////
///////// PRINT UNION of TWO SETS /////////// 
 
//Integerset s4,s5,s6;
 
 
cout<<"Enter two set to take union of them "<<endl
 
cin>>k
cin>>m
if(
k==1

if(
m==2

s5=s1.Unionofsets(s6,s2,s1); 
cout<<" unionset of first and second set = "
s5.Display();cout<<endl

 
else if(
m==3

s5=s1.Unionofsets(s6,s3,s1); 
cout<<" unionset of first and third set = "
s5.Display();cout<<endl


else if(
k==2

if(
m==3

s5=s6.Unionofsets(s6,s3,s2); 
cout<<" union of second and third set = "
s5.Display();cout<<endl

cout<<endl;
////////////////////////////////////////////////////////////////////////
////////// PRINT INTERSECTIONSET of TWO SET... ////////////
 
 
 
cout<<" enter two set to take intersection of them "
cin>>k
cin>>m
if(
k==1

if(
m==2

st4=s11.Intersection(s11,s22,st5); 
cout<<" intersectionset of first and second set = "
st4.Display();cout<<endl

else if(
m==3

st4=s11.Intersection(s11,s33,st5); 
cout<<" intersectionset of first and third = "
st4.Display();cout<<endl

else if(
m==4

st4=s11.Intersection(s11,s5,st5); 
cout<<" intersectionset of first and fourth = "
st4.Display();cout<<endl
}

else if(
k==2

if(
m==3

st4=s22.Intersection(s22,s33,st5); 
cout<<" intersectionset of second and third = "
st4.Display();cout<<endl

else if(
m==4

st4=s22.Intersection(s22,s5,st5); 
cout<<" intersectionset of second and fourth = "
st4.Display();cout<<endl
}

else if(
k==3)
{
if(
m==4)
{
st4=s33.Intersection(s33,s5,st5); 
cout<<" intersectionset of second and third = "
st4.Display();cout<<endl

}
////////////////////////////////////////////////////////////////////////
//////// CHECK MEMBER or NOT... //////////// //|
 
cout<<endl;
cout<<endl
int z,y
cout<<" enter a number to check it is member of sets or not : "
cin>>y
cout<<" which set do you want to check "
cin>>z
cout<<endl
if(
z==1
{ if(
s1.memberof(y)) 
cout<<" yes "<<y<<" is member of first set "<<endl
else 
cout<<" No "<<y<<" is not member of first set "<<endl
cout<<endl

else if(
z==2
{ if(
s2.memberof(y)) 
cout<<" yes "<<y<<" is member of second set "<<endl
else 
cout<<" No "<<y<<" is not member of second set "<<endl
cout<<endl

else if(
z==3
{ if(
s3.memberof(y)) 
cout<<" yes "<<y<<" is member of third set "<<endl
else 
cout<<" No "<<y<<" is not member of third set "<<endl
cout<<endl

else if(
z==4
{ if(
s5.memberof(y)) 
cout<<" yes "<<y<<" is member of unionset "<<endl
else 
cout<<" No "<<y<<" is not member of unionset "<<endl
cout<<endl

else if(
z==5
{ if(
st4.memberof(y)) 
cout<<" yes "<<y<<" is member of intersectionset "<<endl
else 
cout<<" No "<<y<<" is not member of intersectionset "<<endl
cout<<endl

 
 
 
//////////////////////////////////////////////////////////////////////////
///////// INSERTING NUMBER to CURRENT SETS (s1,s2,s3) /////////
char ch
cout<<" 1-first set : "
s1.Display(); 
cout<<endl
cout<<" 2-second set : "
s2.Display(); 
cout<<endl
cout<<" 3-third set : "
s3.Display(); 
cout<<endl;
cout<<" 4-unionset : ";
s5.Display(); 
cout<<endl;
cout<<" 5-intersectionset : ";
st4.Display();
cout<<endl;
 

 
int f,g,loc
cout<<" enter a number to insert "
cin>>f
cout<<endl
cout<<" Which set would you like to insert number "<<f<<""
cin>>g
cout<<" Which location would you like to insert ? :";
cin>>loc
if(
g==1
 
s1.Insertelem(f,loc); 
s1.Display(); 

else if(
g==2
s2.Insertelem(f,loc); 
s2.Display(); 

else if(
g==3
s3.Insertelem(f,loc); 
s3.Display(); 

else if(
g==4)
s5.Insertelem(f,loc);
s5.Display();
}
else if(
g==5)
{
st4.Insertelem(f,loc);
st4.Display();
}
else if(
g==5)
{
s.Insertelem(f,loc);
s.Display();
}
//////////////////////////////////////////////////////////////////////////
/////////// DELETING NUMBER from CURRENT SETS (s1,s2,s3) ///////// 
cout<<endl
 
cout<<" 1-first set : "
s1.Display(); 
cout<<endl
cout<<" 2-second set : "
s2.Display(); 
cout<<endl
cout<<" 3-third set : "
s3.Display(); 
cout<<endl;
cout<<" 4-unionset : ";
s5.Display(); 
cout<<endl;
cout<<" 5-intersectionset : ";
st4.Display();
cout<<endl;
 
cout<<endl;
 
 
int r
cout<<" enter a number to delete : "
cin>>r
cout<<" from which set would you like to delete number "<<r<<""
cin>>g
 
 
if(
g==1
s1.DeleteElem(r); 
s1.Display(); 

else if(
g==2
s2.DeleteElem(r); 
s2.Display(); 

else if(
g==3
s3.DeleteElem(r); 
s3.Display(); 

else if(
g==4)
s5.DeleteElem(r);
s5.Display();
}
else if(
g==5)
{
st4.DeleteElem(r);
st4.Display();
}
else if(
g==5)
{
s.DeleteElem(r);
s.Display();
}

////////////////////////////////////////////////////////////////////////////
///////////// FIRST AND SECOND set ARE EQUAL or NOT ///////////////////
cout<<endl
int temp;
temp=s1.Equal(s1,s2); 
if(
temp==1
cout<<"first set : "
s1.Display(); 
cout<<"second set : "
s2.Display(); 
cout<<"they are equal "<<endl

else 
cout<<"first set : "
s1.Display(); 
cout<<"second set : "
s2.Display(); 
cout<<"they are not equal "<<endl
cout<<endl
 
 
 
 
return 
0;

aLayıNaiSyaN isimli Üye şimdilik offline konumundadır  
Digg this Post!Bookmark Post in Technorati
Alıntı ile Cevapla
Alt 04-09-08, 17:13   #8
Dokunma Yanarsın
 
aLayıNaiSyaN - ait Kullanıcı Resmi (Avatar)
 
Üyelik tarihi: 04-02-08
Nerden: . . .
Mesajlar: 1,981
Tecrübe Puanı: 496 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000
Cevap: C++ Örnek Kodlar

hesap makinesi

PHP- Kodu:
#include<stdio.h> 
int toplama(s1,s2); 
int cikarma(s1,s2); 
int bolme (s1,s2); 
int carpma (s1,s2); 
main() 

int s1,s2,st
char i
printf("HESAP MAKINASI S.1.0\n"); 
printf("Islemi yaziniz:\n"); 
scanf("%d%c%d",&s1,&i,&s2); 
switch(
i

case 
'+':toplama(s1,s2); 
break; 
case 
'-':cikarma(s1,s2); 
break; 
case 
'/':bolme(s1,s2); 
break; 
case 
'*':carpma(s1,s2); 
break; 
default :
printf("Yanlis islem\n"); 

system ("PAUSE"); 
return 
0

 
toplama(s1,s2

         
printf("Toplama isleminin sonucu:%d\n",s1+s2); 

 
cikarma(s1,s2

         
printf("Cikarma isleminin sonucu:%d\n",s1-s2); 

bolme(s1,s2

       
printf("Bolme isleminin sonucu:%d\n",s1/s2); 

carpma(s1,s2

        
printf("Carpma isleminin sonucu:%d\n",s1*s2); 

aLayıNaiSyaN isimli Üye şimdilik offline konumundadır  
Digg this Post!Bookmark Post in Technorati
Alıntı ile Cevapla
Alt 04-09-08, 17:14   #9
Dokunma Yanarsın
 
aLayıNaiSyaN - ait Kullanıcı Resmi (Avatar)
 
Üyelik tarihi: 04-02-08
Nerden: . . .
Mesajlar: 1,981
Tecrübe Puanı: 496 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000
Cevap: C++ Örnek Kodlar

Kayan yazı programı

PHP- Kodu:
#include <stdio.h>
#include <stdlib.h>
 
int main()
{
    
int i,j=0;
 
    do {
        for (
i=0i<ji++) printf(" ");
        
printf("OZGUN BILGETAY");
        
j++;
        
system("CLS");
        if (
j==81-strlen("Hossohbet.Com")) j=0;
    } while (!
kbhit());   //  kullanıcının herhangi bi tuşa basmasını bekler
 
    
return 0;

aLayıNaiSyaN isimli Üye şimdilik offline konumundadır  
Digg this Post!Bookmark Post in Technorati
Alıntı ile Cevapla
Alt 04-09-08, 17:15   #10
Dokunma Yanarsın
 
aLayıNaiSyaN - ait Kullanıcı Resmi (Avatar)
 
Üyelik tarihi: 04-02-08
Nerden: . . .
Mesajlar: 1,981
Tecrübe Puanı: 496 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000 aLayıNaiSyaN 1000
Cevap: C++ Örnek Kodlar

PHP- Kodu:
[b]#include<conio.h>Dışarıdan girilen 3 Sayının En Küçüğünü Bulan Program.
 
[php]#incude<stdio.h> 
int s1,s2,s3;
int i;
main()
{clrscr();
printf("1.sayi gir");scanf("%d",&s1);
printf("2.sayi gir");scanf("%d",&s2);
printf("3.sayi gir");scanf("%d",&s3);
if (s1<s3) && (s1<s3)
printf("1.sayi en küçük");
else if (s2<s3)
printf("2.sayi en küçük");
else printf("3.sayi en küçük");
Getch();
}[/b][/php]
aLayıNaiSyaN isimli Üye şimdilik offline konumundadır  
Digg this Post!Bookmark Post in Technorati
Alıntı ile Cevapla
Cevapla

  • Submit Thread to Digg Digg
  • Submit Thread to del.icio.us del.icio.us
  • Submit Thread to StumbleUpon StumbleUpon
  • Submit Thread to Google Google
  • Bookmarks

    Seçenekler
    Stil

    Yetkileriniz
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is Açık
    Smileler Açık
    [IMG] Kodları Açık
    HTML-KodlarıKapalı
    Trackbacks are Açık
    Pingbacks are Açık
    Refbacks are Açık



    Bütün Zaman Ayarları WEZ olarak düzenlenmiştir. Şu Anki Saat: 13:27 .


    Powered by vBulletin Version 3.8.7
    Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
    Search Engine Friendly URLs by vBSEO 3.5.0 RC2
    Sohbet ve Sohbet odalari sitesi

    Sohbet Chat Forum Oyunlar1