コード例 #1
0
ファイル: Program.cs プロジェクト: heldersepu/csharp-proj
        static void ProcessStock(List<int> StockHistory)
        {
            var stockDelta = new StockDelta(StockHistory);
            Console.ForegroundColor = ConsoleColor.White;
            for (int i = 0; i < StockHistory.Count - 1; i++)
            { //TODO : Check profit before changing
                Utils.WriteChart(i, StockHistory[i], StockHistory[i + 1]);

                if (StockHistory[i] < stockDelta.start.value)
                {
                    stockDelta = new StockDelta(i, StockHistory[i]);
                }
                if (StockHistory[i] > stockDelta.end.value)
                {
                    stockDelta.end.position = i;
                    stockDelta.end.value = StockHistory[i];
                }
            }
            Utils.WriteResult(stockDelta);
        }
コード例 #2
0
        static void ProcessStock(List <int> StockHistory)
        {
            var stockDelta = new StockDelta(StockHistory);

            Console.ForegroundColor = ConsoleColor.White;
            for (int i = 0; i < StockHistory.Count - 1; i++)
            { //TODO : Check profit before changing
                Utils.WriteChart(i, StockHistory[i], StockHistory[i + 1]);

                if (StockHistory[i] < stockDelta.start.value)
                {
                    stockDelta = new StockDelta(i, StockHistory[i]);
                }
                if (StockHistory[i] > stockDelta.end.value)
                {
                    stockDelta.end.position = i;
                    stockDelta.end.value    = StockHistory[i];
                }
            }
            Utils.WriteResult(stockDelta);
        }
コード例 #3
0
ファイル: Utils.cs プロジェクト: whoisjohngalt83/csharp-proj
        public static void WriteResult(StockDelta stockDelta)
        {
            Console.BackgroundColor = ConsoleColor.Black;
            Console.ForegroundColor = ConsoleColor.Green;
            Console.CursorTop       = 21 - stockDelta.start.value;
            for (int i = stockDelta.start.position; i <= stockDelta.end.position; i++)
            {
                Console.CursorLeft = i;
                Console.CursorTop  = 21 - stockDelta.start.value;
                Console.Write((char)9604);
                Console.CursorLeft = i;
                Console.CursorTop  = 19 - stockDelta.end.value;
                Console.Write((char)9600);
            }

            Console.ForegroundColor = ConsoleColor.White;
            Console.CursorTop       = 18;
            Console.CursorLeft      = 0;
            Console.WriteLine(" Result");
            Console.WriteLine(stockDelta.ToString());
            Console.ReadLine();
            Console.Clear();
        }
コード例 #4
0
ファイル: Utils.cs プロジェクト: heldersepu/csharp-proj
        public static void WriteResult(StockDelta stockDelta)
        {
            Console.BackgroundColor = ConsoleColor.Black;
            Console.ForegroundColor = ConsoleColor.Green;
            Console.CursorTop = 21 - stockDelta.start.value;
            for (int i = stockDelta.start.position; i <= stockDelta.end.position; i++)
            {
                Console.CursorLeft = i;
                Console.CursorTop = 21 - stockDelta.start.value;
                Console.Write((char)9604);
                Console.CursorLeft = i;
                Console.CursorTop = 19 - stockDelta.end.value;
                Console.Write((char)9600);
            }

            Console.ForegroundColor = ConsoleColor.White;
            Console.CursorTop = 18;
            Console.CursorLeft = 0;
            Console.WriteLine(" Result");
            Console.WriteLine(stockDelta.ToString());
            Console.ReadLine();
            Console.Clear();
        }