コード例 #1
0
ファイル: hello.cs プロジェクト: dbahrt/hello
        //----------
        // main() serves as the program entry point.
        // gotta have one Main() function per program.
        // it is responsible for:
        // 1) handling the inputs to the program (command line arguments),
        // 2) overseeing the program functionality, and
        // 3) returning the output result of the program.
        //----------
        public static int Main(string [] args)
        {
            Useful.dumpStringArray(args, "command line arguments:");

            int result = driver();

            Console.WriteLine("\ndisplay result by typing ");
            Console.WriteLine("    \"echo %ERRORLEVEL%\" in Windows, or ");
            Console.WriteLine("    \"echo $?\" in Linux \n");
            return(result);
        } // end Main() function
コード例 #2
0
        } // end Main() function

        //----------
        private static int driver( )
        {
            Console.WriteLine("Hello, World.\n");

            List <string> inpstrings;

            readStringsFromKeyboard(out inpstrings);
            Useful.dumpStringList(inpstrings, "keyboard input:");

            Console.Write("Press Enter to continue...");
            Console.ReadLine();

            return(SUCCESS);
        } // end function driver()
コード例 #3
0
        //----------
        public static int Main(string [] args)
        {
            Useful.dumpStringArray(args, "command line arguments:");

            int result = driver();

            // return the terminal status of the program back to the user.
            // normally for command line interface programs,
            // a return code of 0 means "SUCCESS"
            // anything else means "FAIL"
            Console.WriteLine("\ndisplay result by typing ");
            Console.WriteLine("    \"echo %ERRORLEVEL%\" in Windows, or ");
            Console.WriteLine("    \"echo $?\" in Linux \n");
            return(result);
        } // end Main() function
コード例 #4
0
        //----------
        public static void Main(string[] args)
        {
            HangmanGame hangman = new HangmanGame();

            if ((args.Length != 1) || (!File.Exists(args[0])) ||
                (!hangman.initWordList(args[0])))
            {
                Console.WriteLine("usage: hangman.exe <wordlist file name>.txt");
                return;
            }
            do
            {
                hangman.gameDriver();
            } while(Useful.selectOpt("\nPlay again (Y|N)? ", ynOpts) == 0);
            return;
        } // end function Main()