标签:io ar sp c on cti r ad line
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Random rd = new Random();
            int real = rd.Next(100) + 1;
            Console.WriteLine("随即输入1-100的整数:");
           
            do
            {
                string s = Console.ReadLine();
                int x = int.Parse(s);
                if (x > real)
             {
                 Console.WriteLine("大了!");
             }
                else if (x < real)
             {
                 Console.WriteLine("小了!");
             }
              else
                {
                    Console.WriteLine("恭喜你猜对了!");
                    break;
                }
            }
            while (true);
            Console.ReadKey();
        }
    }
    
}
标签:io ar sp c on cti r ad line
原文地址:http://blog.csdn.net/zjx211314/article/details/39692115