Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3071744
  • 博文数量: 1412
  • 博客积分: 15478
  • 博客等级: 上将
  • 技术积分: 14938
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-23 16:08
文章存档

2016年(1)

2015年(17)

2013年(13)

2012年(103)

2011年(185)

2010年(261)

2009年(425)

2008年(363)

2007年(44)

分类: 数据库开发技术

2009-06-26 23:10:34

while循环,与for循环不同的是:循环次数不固定.如
using System;
using System.Collections.Generic;
using System.Text;
namespace _._while循环
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();//用read接受str
            while (str.Length == 2)//如果长度等于2的话,(让其一直走)
            {
                Console.WriteLine("你输入的字符正确!");
                str = Console.ReadLine();//readline意思是读一行字符
            }
        }
    }
}
 
 
阅读(602) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~