简单汽车售票管理系统

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

namespace 简单客车售票系统
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Title = " 简单客车售票系统";
            string[,] zuo = new string[9, 4];
            //初始化 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.Write("请输入座位行号和列号(如0,2),输入q键退出:");
                s = System.Console.ReadLine();//售票信息输入
                if (s == "q")
                {
                    break;
                }

                //拆分字符串
                string[] ss = s.Split(',');
                int one = int.Parse(ss[0]);  //得到座位行数
                int two = int.Parse(ss[1]);  //得到座位列数
                zuo[one, two] = "已售";  //标记出票状况
            }
        }
    }
}

猜你喜欢

转载自blog.csdn.net/hello_leiyuanyi/article/details/81197102
今日推荐