Example #1
0
        static void Main()
        {
            string[] lines            = new string[10001];
            int      maxCommandLineId = 0;

            for (int i = 0; i < lines.Length; i++)
            {
                lines[i] = string.Empty;
            }

            while (true)
            {
                string line = Console.ReadLine();
                if (line == "RUN")
                {
                    break;
                }
                else // Parse the line info
                {
                    string[] lineNumberAndCommand = line.Split(new char[] { ' ' }, 2);
                    int      lineId = int.Parse(lineNumberAndCommand[0]);
                    lines[lineId]    = lineNumberAndCommand[1].Trim();
                    maxCommandLineId = lineId;
                }
            }

            BasicBASICExecutor executor = new BasicBASICExecutor();

            executor.ExecuteCode(lines, maxCommandLineId);
            Console.Write(executor.GetOutputResult());
        }
        static void Main()
        {
            string[] lines = new string[10001];
            int maxCommandLineId = 0;

            for (int i = 0; i < lines.Length; i++)
            {
                lines[i] = string.Empty;
            }

            while (true)
            {
                string line = Console.ReadLine();
                if (line == "RUN")
                {
                    break;
                }
                else // Parse the line info
                {
                    string[] lineNumberAndCommand = line.Split(new char[] { ' ' }, 2);
                    int lineId = int.Parse(lineNumberAndCommand[0]);
                    lines[lineId] = lineNumberAndCommand[1].Trim();
                    maxCommandLineId = lineId;
                }
            }

            BasicBASICExecutor executor = new BasicBASICExecutor();
            executor.ExecuteCode(lines, maxCommandLineId);
            Console.Write(executor.GetOutputResult());
        }