SHARE
TWEET

naprawione ale ułomne xd

a guest Nov 14th, 2019 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5.  
  6. int main()
  7. {
  8.     int i;
  9.     int j;
  10.     int x;
  11.     int y;
  12.     //tworzenie tablicy
  13.     int tablica [11][11]={0};
  14.     for (i=0 ; i<11 ; i++){
  15.         for (j=0; j<11; j++){
  16.             if (i==0) {
  17.                 if (j==0)
  18.                 printf ("#");
  19.                 else printf ("%d", j-1);
  20.             }
  21.             else if (j==0) printf ("%d", i-1);
  22.         printf("%d", tablica [j][i]);
  23.         }
  24.         printf("\n");
  25.     }
  26.     // wybieranie pola
  27.     char av = 'X';
  28.     printf("Podaj numer kolumny i wiersza:\n");
  29.     scanf("%d %d", &y, &x);
  30.  
  31.     //zmiana wartości
  32.     for (i=-1; i<=1; i++) {
  33.         for (j=-1; j<=1; j++) {
  34.             if (abs(j) != abs(i)) {
  35.                 if (tablica[y+j][x+i] == 0) tablica[y+j][x+i] = 1;
  36.                 else tablica[y+j][x+i] = 0;
  37.  
  38.     }
  39.  
  40. }
  41. }
  42. for (i=0 ; i<11 ; i++){
  43.         for (j=0; j<11; j++){
  44.         if (tablica[j][i]==0)printf("%d", tablica [j][i]);
  45.         else printf("X");
  46.         }
  47.         printf("\n");
  48. }
  49.     return 0;
  50. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top