06.HighQualityMethodsHomework/RefactorCSharpPart2Exam/11. CSharp-Part-2-Exam/CSharp-Part-2-Exam/CatConcert/CatConcert.cs
/// <summary>
/// Reads the input for the assignment
/// </summary>
/// <returns>2-dimensional array of boolean values</returns>
Reads the input for the assignment
Reads the input for the assignment
private static bool[,] ReadInput()
        {
            var firstLine = Console.ReadLine();
            var secondLine = Console.ReadLine();
            var catsCount = int.Parse(firstLine.Split(' ')[0]);
            var songsCount = int.Parse(secondLine.Split(' ')[0]);
            var catSongs = new bool[catsCount, songsCount];
            while (true)
            {
                var line = Console.ReadLine();
                if (line == "Mew!")
                {
                    break;
                }
                var lineParts = line.Split(' ');
                var cat = int.Parse(lineParts[1]);
                var song = int.Parse(lineParts[4]);
                catSongs[cat - 1, song - 1] = true;
            }
            return catSongs;
        }
private static bool [ , ] ReadInput ( ) { var firstLine = Console . ReadLine ( ) ; var secondLine = Console . ReadLine ( ) ; var catsCount = int . Parse ( firstLine . Split ( ' ' ) [ 0 ] ) ; var songsCount = int . Parse ( secondLine . Split ( ' ' ) [ 0 ] ) ; var catSongs = new bool [ catsCount , songsCount ] ; while ( true ) { var line = Console . ReadLine ( ) ; if ( line == " " ) { break ; } var lineParts = line . Split ( ' ' ) ; var cat = int . Parse ( lineParts [ 1 ] ) ; var song = int . Parse ( lineParts [ 4 ] ) ; catSongs [ cat - 1 , song - 1 ] = true ; } return catSongs ; }
Reads the input for the assignment
Reads the input for the assignment
// Cat X knows song Y // Cats are numbered from 1 to C // Songs are numbered from 1 to S
2-dimensional array of boolean values
2 - dimensional array of boolean values