B. Tic-Tac-Toe Source Code Listing
#define CSHARP2 using System; #pragma warning disable 1030 // Disable user-defined warnings // The TicTacToe class enables two players to // play tic-tac-toe. class TicTacToeGame // Declares the TicTacToeGame class. { static void Main() // Declares the entry point to the program. { // Stores locations each player has moved. int[ ] playerPositions = { 0, 0 }; // Initially set the currentPlayer to Player 1. int currentPlayer = 1; // Winning player. int winner = 0; string input = null; // Display the board and prompt the current player // for his next move. for (int
Get Essential C# 6.0 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.