Guest User

Untitled

a guest
Jan 23rd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. #include <array>
  2. #include <iomanip>
  3. #include <iostream>
  4. #include "Board.h"
  5.    
  6. int main()
  7. {
  8.     Test a = Test(2);
  9.     a.printGrid();
  10.     system("Pause");
  11. }
  12.  
  13.  
  14. #ifndef TEST_H_
  15. #define TEST_H_
  16. #include <iostream>
  17. #include <iomanip>
  18. #include <array>
  19.  
  20. class Test
  21. {
  22.     public:
  23.         Test(int c);
  24.         char grid[5][10];
  25.         void printGrid();
  26.         void addToGrid(char c, int x, int y);
  27. };
  28.  
  29. #endif
  30.  
  31.  
  32. #include "Test.h"
  33.  
  34. using namespace std;
  35.  
  36. Test::Test(int c)
  37. {
  38.     for(int i = 0; i < 5; i++)
  39.     {
  40.         for(int j = 0; j < 10; j++)
  41.         {
  42.             grid[i][j] = '@';
  43.         }
  44.     }
  45. }
  46.  
  47. void Test::printGrid()
  48. {
  49.     for(int i = 0; i < 5; i++)
  50.     {
  51.         for(int j = 0; j < 10; j++)
  52.         {
  53.             cout << grid[i][j];
  54.         }
  55.         cout << endl;
  56.     }
  57. }
  58.  
  59. void Test::addToGrid(char c, int x, int y)
  60. {
  61.     grid[y][x] = c;
  62.     cout << c << " added to grid." << endl;
  63. }
Add Comment
Please, Sign In to add comment