日期:2014-05-16  浏览次数:21176 次

C#新手求助,判断输入的为4位整数
循环录入3个会员信息 会员号必须为4位整数,若非法则输出提示,以下是小弟的代码  没能实现判断
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mybuild
{
    class Program
    {//循环录入会员信息
        static void Main(string[] args)
        {
            string Num; string Birthday; string Integral; char a; int j;
            Console.WriteLine("Myshopping管理系统>客户信息管理>添加客户信息");
            for (int i =0; i < 3; i++)
            {
                Console.WriteLine("请输入会员号(4位整数):");
                    Num = Console.ReadLine();
                   Console.WriteLine("请输入会员生日:");
                    Birthday= Console.ReadLine();
                   Console.WriteLine("请输入会员积分:");
                    Integral= Console.ReadLine();
                   
                for ( j = 0; j < 5; )                    
                    {  a = Convert.ToChar(Num.Substring(j, 1));
                        if (a <= 9 && a >= 0)                        
                            j++;                                                   
                        else
                            break; }                   
           &nbs