msr3310
02-05-2014, 22:36
سلام عليكم اخواني انا صراحة مبتدئ في البرمجة وقمت بكتابة التعليمة التالية وسؤالي هنا
Console.WriteLine("Would you prefer What is behind the door number 1,2 or 3 ? ");
int x;
if (x == 1)
{
Console.WriteLine("you win a car");
Console.ReadLine();
}
else if (x == 2)
{
Console.WriteLine("You won nothing! Hardluck");
Console.ReadLine();
}
else if (x == 3)
{
Console.WriteLine("You won a 1000 AED");
Console.ReadLine();
}
else
{
Console.WriteLine("you have insert invalid value please choose number 1,2 or 3");
Console.ReadLine();
}
عاوز اعرف الخطأ الناتج هو
use of unassigned local variable 'x'
ليه ما فيني عرف المتحول كعدد ولازم حصرا سترينغ ؟
وجزاكم الله كل خير
Console.WriteLine("Would you prefer What is behind the door number 1,2 or 3 ? ");
int x;
if (x == 1)
{
Console.WriteLine("you win a car");
Console.ReadLine();
}
else if (x == 2)
{
Console.WriteLine("You won nothing! Hardluck");
Console.ReadLine();
}
else if (x == 3)
{
Console.WriteLine("You won a 1000 AED");
Console.ReadLine();
}
else
{
Console.WriteLine("you have insert invalid value please choose number 1,2 or 3");
Console.ReadLine();
}
عاوز اعرف الخطأ الناتج هو
use of unassigned local variable 'x'
ليه ما فيني عرف المتحول كعدد ولازم حصرا سترينغ ؟
وجزاكم الله كل خير