怎样锻炼编程思想-请看代码
static void Main(string[] args){
bool numbersOK = false;
double var1, var2;
var1 = 0;
var2 = 0;
while (!numbersOK)
{
Console.WriteLine("Give me a number:");
var1 = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Give me another number:");
var2 = Convert.ToDouble(Console.ReadLine());
if ((var1 > 10) ^ (var2 > 10))
{
numbersOK = true;
}
else
{
if ((var1 <= 10) && (var2 <= 10))
{
numbersOK = true;
}
else
{
Console.WriteLine("Only one number may be greater than 10.");
}
}
}
Console.WriteLine("You entered {0} and {1}.", var1, var2);
}
这段代码我能看懂,但是我怎么不能够又这种思想啊! 各位给点意见吧 !!!!!!