Hi,
I am new to C#. I have compiled and executed the following program in Microsofr Visual Studio .NET 2003 .
using System;
publicclass Enumdemo
{
enum Color{
red,
blue,
black,
green
}
public static void Main(string[] args) {
Color Mycolor;
System.Console.Write("Enter the values: 0 for red 1 for blue 2 for black 3 for green\n");
string a = Console.ReadLine();
System.Console.WriteLine("the value of the a is {0}",a);
Mycolor = (Color) Convert.ToInt32(a);
switch(Mycolor){
case Color.blue: System.Console.WriteLine("you have choosen the value blue ");
break;
case Color.red: System.Console.WriteLine("you have choosen the value red ");
break;
case Color.black: System.Console.WriteLine("you have choosen the value black ");
break;
case Color.green: System.Console.WriteLine("you have choosen the value green ");
break;
default: System.Console.WriteLine("you have choosen no color ");
break;
}
}
}
It is not reading the input from the user for the following line
"System.Console.Write("Enter the values: 0 for red 1 for blue 2 for black 3 for green\n");
string a = Console.ReadLine();"
Its not allowing me to enter some value for "a". Its giving the
out put as
"you have choosen the value red " without entering anything.
How to get the output in a seperate console window(black window).