Process Class (System.Diagnostics)

import sys


def hanoi(n, a, b, c):
    if n == 1:
        print('%c --> %c' % (a, c))
    else:
        hanoi(n-1, a, c, b)
        print('%c --> %c' % (a, c))
        hanoi(n-1, b, a, c)


if __name__ == "__main__":
    n = int(sys.stdin.readline())
    hanoi(n, 'A', 'B', 'C')
using System.Diagnostics;

namespace Hanoi
{
    class Program
    {
        static void Main(string[] args)
        {
            Process process = new Process
            {
                StartInfo = new ProcessStartInfo
                {
                    FileName = "python",
                    Arguments = "hanoi.py",
                    UseShellExecute = false
                }
            };
            process.Start();
            process.WaitForExit();
        }
    }
}

猜你喜欢

转载自www.cnblogs.com/JebediahKerman/p/Process_Class_System_Diagnostics.html