0
#include <iostream>
#include <iomanip>
using namespace std;
struct Node {
 int number;
 char color;
 bool open;
};
    
#define DEPTH 5
#define ROW 3
#define COL 6
void setNodes( Node nodeArray [ROW][COL][DEPTH]);
void setNode (Node &node, int depth);
void printArray (Node nodeprint [ROW][COL][DEPTH], int depth);
void main ()
{
    Node nodeArray [ROW][COL][DEPTH];
 setNodes(nodeArray);
 printArray (nodeArray, 3);
}
void setNodes( Node nodeArray [ROW][COL][DEPTH]) {
 for (int r=0; r<ROW; r++){
  for (int c=0; c<COL; c++){
   for (int d=0; d<DEPTH; d++){
    setNode(nodeArray[r][c][d], d );
//cout << "node " << r << c << d << ' ' << nodeArray[r][c][d]. number << endl;
   }
  }
 }
 
}
void setNode (Node &node, int depth){
 node.number=depth;
 node.color='r';
 node.open=true;
}

void printArray (Node nodeprint [ROW][COL][DEPTH], int depth){
 for (int r=0; r<ROW; r++){
  for (int c=0; c<COL; c++){
   cout << nodeprint[r][c][depth].number << ' ';
  }
  cout << endl;
 }
 cout << endl;
}

the result you get when you run it is

3 3 3 3 3 3
3 3 3 3 3 3
3 3 3 3 3 3

but how can i get those threes to print in light blue or any other color i want?

5
Contributors
4
Replies
5
Views
10 Years
Discussion Span
Last Post by vegaseat
0

please use code tags to maintain spacing and make it easier for everyone to read. If you do not know how to use them, then please read the articles in the links in my signature below.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.