Advertisement
HeroBaga

Untitled

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