コード例 #1
0
ファイル: digitRand.cs プロジェクト: khrabrov/Lesko3
        private int[,] iCountDigits(int iVarNum)
        {
            int[,] iArr = new int[4, 16]
            {
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
            };

            List <string> lBin    = new List <string>();
            toBase2Tool   tb2tObj = new toBase2Tool();

            for (int iFileCount = 0; iFileCount < 4; iFileCount++)
            {
                lBin = tb2tObj.getByteList(iVarNum + "\\Task1\\" + iFileCount);

                foreach (string sListCont in lBin)
                {
                    for (int i = 0; i < 16; i++)
                    {
                        if (sListCont.Length > i && sListCont[i] == '1')
                        {
                            iArr[iFileCount, i]++;
                        }
                    }
                }
            }

            return(iArr);
        }
コード例 #2
0
ファイル: digitRand2.cs プロジェクト: khrabrov/Lesko3
        private int[,] iCountDigits(int iVarNum)
        {
            int[,] iArr = new int[4, 17]
            {
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
            };

            List <string> lBin    = new List <string>();
            toBase2Tool   tb2tObj = new toBase2Tool();

            for (int iFileCount = 0; iFileCount < 4; iFileCount++)
            {
                lBin = tb2tObj.getByteList(iVarNum + "\\Task1\\" + iFileCount);

                foreach (string sListCont in lBin)
                {
                    int iInnerCounter = 0;
                    foreach (char cInString in sListCont)
                    {
                        iInnerCounter++;
                        if (cInString == '1')
                        {
                            iArr[iFileCount, iInnerCounter]++;
                        }
                    }
                }
            }

            return(iArr);
        }