gabbyshimoni icon

2DarrayToto

gabbyshimoni | PRO | 05/21/18 09:22:34 AM UTC | 0 ⭐ | 450 👁️ | Never ⏰ | []
C++ |

570 B

|

None

|

0 👍

/

0 👎

char toto[3][16];
void setup() {
  Serial.begin(9600);
  for (int i = 0; i < 16; i++) {
    while (Serial.available() == 0);
    char guess = Serial.read();
    if (guess == '1') {
      toto[0][i] = '*'
    }
    if (guess == 'X') {
      toto[1][i] = '*'
    }
    if (guess == '2') {
      toto[2][i] = '*'
    }
  }
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 16; j++) {
      if (toto[i][j] == '*') {
        Serial.print("*");
      }
      else {
        Serial.print(" ");
      }
    }
    Serial.println();
  }
}
 
void loop() {
}

Comments