Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.91 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. #ifndef N
  4. #define N 5
  5. #endif
  6.  
  7. void wypisz_wiersz_spacji() {
  8.     for(int i = 0; i < N + 1; ++i) {
  9.         printf(" ");
  10.     }
  11. }
  12.  
  13. void wypisz_wiersz_sciany_z_przejsciem(int wiersz, int tablica[6][N][N]) {
  14.     for(int kolumna = 0; kolumna < N; ++kolumna){
  15.         printf("%d\n", tablica[0][wiersz][kolumna]);
  16.     }
  17. }
  18.  
  19.  
  20. void up(int tablica[6][N][N]) {
  21.     for(int wiersz = 0; wiersz < N; ++wiersz) {
  22.         wypisz_wiersz_spacji();
  23.         wypisz_wiersz_sciany_z_przejsciem(wiersz, tablica[6][N][N]);
  24.         ++wiersz;
  25.     }
  26. }
  27.  
  28. void wypisz_kostke(int tablica[6][N][N]) {
  29.     up(tablica[6][N][N]);
  30. }
  31.  
  32. int main(void) {
  33.     int tablica[6][N][N];
  34.     int kolor[6] = {0, 1, 2, 3, 4, 5};
  35.     for(int sciana = 0; sciana < 6; ++sciana) {
  36.         for(int wiersz = 0; wiersz < N; ++wiersz){
  37.             for(int kolumna = 0; kolumna < N; ++kolumna){
  38.                 tablica[sciana][wiersz][kolumna] = kolor[sciana];
  39.             }
  40.         }
  41.     }
  42.     wypisz_kostke(tablica[6][N][N]);
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement