fork download
  1. #include <iostream>
  2.  
  3.  
  4. using namespace std;
  5.  
  6.  
  7. struct point {
  8. int state;
  9. int manh;
  10. int done;
  11. };
  12.  
  13. int const n = 1;
  14. int const m = 1;
  15. point pole[n][m] = {{1, 2, 3}};
  16.  
  17.  
  18.  
  19. void print(int point::* member) {
  20. for (int j = 0; j < n; j++)
  21. cout << "--";
  22. cout << '-' << endl;
  23. for (int i = 0; i < m; i++) {
  24. cout << '|';
  25. for (int j = 0; j < n; j++)
  26. cout << pole[i][j].*member << '|';
  27. cout << endl;
  28. for (int j = 0; j < n; j++)
  29. cout <<"--";
  30. cout << '-' << endl;
  31. }
  32. }
  33.  
  34. int main() {
  35. print(&point::state);
  36. print(&point::manh);
  37. print(&point::done);
  38. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
---
|1|
---
---
|2|
---
---
|3|
---