Şimdi Ara

c de chessboard oluşturma

Bu Konudaki Kullanıcılar:
2 Misafir - 2 Masaüstü
5 sn
3
Cevap
0
Favori
97
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • void print_pattern(char c1,char 2,int n,int L) fonksiyonunu kullanarak

    ****xxxx****xxxx****xxxx****xxxx
    ****xxxx****xxxx****xxxx****xxxx
    ****xxxx****xxxx****xxxx****xxxx
    ****xxxx****xxxx****xxxx****xxxx
    xxxx****xxxx****xxxx****xxxx****
    xxxx****xxxx****xxxx****xxxx****
    xxxx****xxxx****xxxx****xxxx****
    xxxx****xxxx****xxxx****xxxx****
    ****xxxx****xxxx****xxxx****xxxx
    ****xxxx****xxxx****xxxx****xxxx
    ****xxxx****xxxx****xxxx****xxxx
    ****xxxx****xxxx****xxxx****xxxx
    xxxx****xxxx****xxxx****xxxx****
    xxxx****xxxx****xxxx****xxxx****
    xxxx****xxxx****xxxx****xxxx****
    xxxx****xxxx****xxxx****xxxx****
    ****xxxx****xxxx****xxxx****xxxx
    ****xxxx****xxxx****xxxx****xxxx
    ****xxxx****xxxx****xxxx****xxxx
    ****xxxx****xxxx****xxxx****xxxx
    xxxx****xxxx****xxxx****xxxx****
    xxxx****xxxx****xxxx****xxxx****
    xxxx****xxxx****xxxx****xxxx****
    xxxx****xxxx****xxxx****xxxx****
    ****xxxx****xxxx****xxxx****xxxx
    ****xxxx****xxxx****xxxx****xxxx
    ****xxxx****xxxx****xxxx****xxxx
    ****xxxx****xxxx****xxxx****xxxx
    xxxx****xxxx****xxxx****xxxx****
    xxxx****xxxx****xxxx****xxxx****
    xxxx****xxxx****xxxx****xxxx****
    xxxx****xxxx****xxxx****xxxx****

    böyle bir chessboard u nasıl yazabiliriz?



  • #include <stdio.h> 
    int main(){
    char chess[32][32];
    int n=0,l=0;
    for(int i=0;i<32;i++){
    for(int j=0;j<32;j++){
    if(n<4){
    if(l<4){
    chess[i][j]='*';
    l++;
    }
    else{
    chess[i][j]='X';
    l++;
    if(l==8)
    l=0;
    }
    }
    else{
    if(l<4){
    chess[i][j]='X';
    l++;
    }
    else{
    chess[i][j]='*';
    l++;
    if(l==8)
    l=0;
    }
    }
    }
    n++;
    if(n==8)
    n=0;
    }
    for(int i=0;i<32;i++){
    for(int j=0;j<32;j++)
    printf("%c",chess[i][j]);
    printf("\n");
    }

    }


    2 Boyutlu matris kullanman gerekiyor. Yani iç içe 2 döngü.
  • 
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.