简单车票管理系统案例

简单车票管理系统

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Title = "简单客车售票系统";
            string[,] zuo = new string[9, 4];
            for (int i = 0; i < 9; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    zuo[i, j] = "【有票】";
                }
            }

            string s = string.Empty;//定义字符串变量
            while (true)
            {
                System.Console.Clear();
                Console.WriteLine("\n     简单客车售票系统" + "\n");//输出字符串
                for (int i = 0; i < 9; i++)
                {
                    for (int j = 0; j < 4; j++)
                    {
                        System.Console.Write(zuo[i, j]);    //输出售票信息
                    }
                    System.Console.WriteLine();    //输出换行符
                }
                System.Console.WriteLine("请输入作为行号和列号(如:0,2)输入q键退出: ");
                s = System.Console.ReadLine();
                if (s == "q") break;
                string[] ss = s.Split(',');
                int x = int.Parse(ss[0]);
                int y = int.Parse(ss[1]);
                zuo[x, y] = "【已售】";
            }

            Console.ReadLine();
        }
    }
}



简单车票管理系统案例_第1张图片


简单车票管理系统案例_第2张图片


简单车票管理系统案例_第3张图片

你可能感兴趣的:(C#学习)