新手求助解答
代码是这样的:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int guess, number =17;
do
{
Console.WriteLine("你猜测的数:");
guess = Console.Read();
if(guess>number)
Console.WriteLine("太大!");
else if(guess<number)
Console.WriteLine("太小!");
}while(guess!=number);
Console.WriteLine("恭喜你,猜中了!");
// Console.ReadLine();
}
}
}
输出的不是自己想象的,如图:
------解决方案--------------------
Console.Read()
=>
Convert.ToInt32(Console.ReadLine())