Advertisement
HeroBaga

Untitled

Aug 21st, 2021
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int size_x = 82, size_y = 27;
  4.  
  5. void game();
  6.  
  7. void display(char core[size_y][size_x]);
  8.  
  9. int main() {
  10. game();
  11. return 0;
  12. }
  13.  
  14. void game() {
  15. char horizontal = '-';
  16. char vertical = '|';
  17. char space = ' ';
  18. char core[27][82];
  19. //TODO сделать считывания из файла
  20. for (int y = 0; y < size_y; y++) {
  21. for (int x = 0; x < size_x; x++) {
  22. if (y == 0 || y == 26) {
  23. core[y][x] = horizontal;
  24. } else if (x == 0 || x == 81) {
  25. core[y][x] = vertical;
  26. } else {
  27. core[y][x] = space;
  28. }
  29. }
  30. }
  31. //Временая задование значений
  32. core[4][1] = 'x';
  33. core[4][2] = 'x';
  34. core[4][3] = 'x';
  35. core[3][3] = 'x';
  36. core[2][2] = 'x';
  37.  
  38. display(core[size_y][size_x]);
  39. }
  40. void display(char core[size_y][size_x]) {
  41. // char (*p_array)[size_x] = core;
  42. for (int y = 0; y < size_y; y++) {
  43. for (int x = 0; x < size_x; x++) {
  44. printf("%c", core[y][x]);
  45. }
  46. printf("%c", '\n');
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement