Advertisement
Guest User

border

a guest
Oct 19th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. #ifndef BORDER_H
  2. #define BORDER_H
  3.  
  4.  
  5.  
  6.  
  7. //int asciiH = 220;
  8. //int asciiW = 219;
  9.  
  10. class Border
  11. {
  12. public:
  13.     //void update ();
  14.     void render ();
  15.       int width=20;
  16.       int height= 20;
  17.     //int move ();
  18.  
  19.  
  20. };
  21.  
  22.  
  23.  
  24.  
  25. #endif
  26.  
  27. #include <cstdlib>
  28. #include <iostream>
  29.  
  30. //#include "Helpers.h"
  31. //#include "Snake.h"
  32. #include "Border.h"
  33. //#include  "Fruit.h"
  34.  
  35.  
  36.  
  37.  
  38. void Border::render ()
  39. {
  40.    
  41.  
  42.  
  43.     for (int i = 1; i < width+2; i++)
  44.         std::cout << "#";
  45.  
  46.     std::cout << "\n";
  47.  
  48.     for (int i = 0; i < height; i++)
  49.     {
  50.         for (int j = 0; j < width; j++)
  51.         {
  52.             if (j == 0)
  53.                 std::cout << "#";
  54.                 std::cout << " ";
  55.  
  56.            
  57.  
  58.                 if (j == width - 1)
  59.                     std::cout << "#";
  60.                     //std::cout << " ";
  61.  
  62.         }
  63.         std::cout << "\n";
  64.  
  65.  
  66.     }
  67.  
  68.  
  69.     for (int i = 0; i < width + 2; i++)
  70.         std::cout << "#";
  71.     std::cout << "\n";
  72.  
  73. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement