Example......
class Program
{
enum gender
{
male,
female
}
static void Main(string[] args)
{
Console.WriteLine("select the 0 for male and 1 for female");
gender name = (gender)Int32.Parse(Console.ReadLine());
if (name == gender.male)
{
Console.WriteLine("select male");
Console.ReadLine();
}
else if(name == gender.female)
{
Console.WriteLine("select female");
Console.ReadLine();
}
}
}
class Program
{
enum gender
{
male,
female
}
static void Main(string[] args)
{
Console.WriteLine("select the 0 for male and 1 for female");
gender name = (gender)Int32.Parse(Console.ReadLine());
if (name == gender.male)
{
Console.WriteLine("select male");
Console.ReadLine();
}
else if(name == gender.female)
{
Console.WriteLine("select female");
Console.ReadLine();
}
}
}
No comments:
Post a Comment