Updated the tictactoe.cpp

This commit is contained in:
Mathias Wagner 2023-09-27 20:51:18 +02:00
parent 71e5a6cb32
commit 5ab0e2ce8c
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -7,10 +7,7 @@ using namespace std;
class TikTakToe {
public:
string rows[9] = {
"-", "-", "-",
"-", "-", "-",
"-", "-", "-"};
string rows[9] = {"-", "-", "-","-", "-", "-","-", "-", "-"};
public:
bool playerWon(string character) {
@ -53,13 +50,14 @@ public:
cout << rows[i] + " ";
}
cout << "\n=====\nWo soll dein X hin? [1-9] ";
}
public:
void awaitInput() {
printBoard();
cout << "\n=====\nWo soll dein X hin? [1-9] ";
int input;
cin >> input;
@ -80,16 +78,20 @@ int main() {
board.awaitInput();
}
cout << "\n===== ENDSTAND =====";
cout << "\n===== ENDSTAND ";
board.printBoard();
cout << "\n===== ENDSTAND =====";
if (board.playerWon("X")) {
cout << "\n\nDu hast gewonnen! Herzlichen Glückwunsch. :)";
} else {
cout << "Du hast legit gegen einen random Bot verloren, würd mir mal Gedanken machen..";
}
cout << "\n\n";
return 0;