using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.ForegroundColor = ConsoleColor.Yellow;
int m = 0;
int n = 0;
Console.Write("zxl");
do
{
switch (Console.ReadKey(true).Key)
{
case ConsoleKey.UpArrow:
n = n - 1;
break;
case ConsoleKey.DownArrow:
n = n + 1;
break;
case ConsoleKey.LeftArrow:
m = m - 1;
break;
case ConsoleKey.RightArrow:
m = m + 1;
break;
}
Console.Clear();
string aa = "";
string bb = "";
for (int a = 0; a < m; a++)
{
aa += " ";
}
for (int b = 0; b < n; b++)
{
bb += "\n";
}
Console.Write(bb + aa + "zxl");
}
while (true);
}
}
}
c# console move string
最新推荐文章于 2024-08-09 21:57:26 发布