C#中的一个控制台程序
using System;
using System。Collections。Generic;
using System。Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
bool flag;
do
{
flag = true;
Console。 Write("请输入五位数大写字母:");
string str = Console。ReadLine();
if (str。 Length != 5)
{
Console。WriteLine("字符个数错误");
f...全部
using System;
using System。Collections。Generic;
using System。Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
bool flag;
do
{
flag = true;
Console。
Write("请输入五位数大写字母:");
string str = Console。ReadLine();
if (str。
Length != 5)
{
Console。WriteLine("字符个数错误");
flag = false;
continue;
}
foreach (char ch in str)
{
if (ch 'Z')
{
Console。
WriteLine("字符输入错误");
flag = false;
break;
}
}
}while(flag==false);
Console。
WriteLine("输入正确");
}
}
}
。收起