Browse Source

Positionsnummer durch 0 ersetzen

remotes/origin/tictactoedev
Sabina Grisi 11 months ago
parent
commit
6275f93be3
  1. 32
      src/TicTacToe.c

32
src/TicTacToe.c

@ -11,8 +11,40 @@ int main() {
int pos7 = 7; int pos7 = 7;
int pos8 = 8; int pos8 = 8;
int pos9 = 9; int pos9 = 9;
int o = 0;
drawBoard(pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9); drawBoard(pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9);
int in;
printf("Choose a number: ");
scanf("%d", &in);
printf("\n");
if (pos1 == in) {
pos1 = o;
} else if (pos2 == in) {
pos2 = o;
} else if (pos3 == in) {
pos3 = o;
} else if (pos4 == in) {
pos4 = o;
} else if (pos5 == in) {
pos5 = o;
} else if (pos6 == in) {
pos6 = o;
} else if (pos7 == in) {
pos7 = o;
} else if (pos8 == in) {
pos8 = o;
} else if (pos9 == in) {
pos9 = o;
} else {
printf("Not Available.");
}
drawBoard(pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9);
return 0;
} }
void drawBoard(int pos1, int pos2, int pos3, int pos4, int pos5, int pos6, int pos7, int pos8, int pos9) { void drawBoard(int pos1, int pos2, int pos3, int pos4, int pos5, int pos6, int pos7, int pos8, int pos9) {

Loading…
Cancel
Save