コード例 #1
0
        private static string getXCharInt(int i_numOfDigits)
        {
            Console.WriteLine("Please type a 9 digits number");
            string inputStr = Console.ReadLine();

            while (inputStr.Length != 9 || !Ex4Proj.IsLanguageByAsciiCodesBounds(inputStr, '0', '9'))
            {
                Console.WriteLine("Invalid input, Please type again");
                inputStr = Console.ReadLine();
            }

            return(inputStr);
        }
コード例 #2
0
        private static int countDigitsDividedByNum(string i_numToDivideStr, int i_numToDivideIn)
        {
            int dividedByNumCounter = 0;

            while (i_numToDivideStr.Length > 0)
            {
                if (Ex4Proj.IsDevidedByNum((i_numToDivideStr[0] - '0'), i_numToDivideIn))
                {
                    dividedByNumCounter++;
                }
                i_numToDivideStr = i_numToDivideStr.Substring(1, i_numToDivideStr.Length - 1);
            }

            return(dividedByNumCounter);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: itaycs2407/HitCourseC-
        public static void Main()
        {
            int numOfStars;

            Console.WriteLine("Please enter the number of stars for the base and the seal :");
            string inputNumOfStars = Console.ReadLine();

            while (!Ex4Proj.IsLanguageByAsciiCodesBounds(inputNumOfStars, '0', '9'))
            {
                Console.WriteLine("invalid number, Please enter the number of stars for the base and the seal :");
                inputNumOfStars = Console.ReadLine();
            }
            numOfStars = int.Parse(inputNumOfStars);
            if (numOfStars % 2 == 0)
            {
                numOfStars++;
            }
            Ex2Proj.PrintSandTimer(numOfStars, 0);
        }