Im pretty new to programming and I have a challenge but i need your help. My task is to write a program which is reading something from the console and then if its number it will print 1, if its string it will look like this (string + *). Heres my code but there is something wrong and I cant figure it out.Its a must to use Switch - Case.
static void Main(string[] args)
{
string x = Console.ReadLine();
switch (x)
{
case "int" :
int i = int.Parse(x);
i = i + 1;
Console.WriteLine(i);
break;
case "double":
double d = double.Parse(x);
d = d + 1;
Console.WriteLine(d);
break;
case "string":
string s = (x);
Console.WriteLine(s + "*");
break;
default:
break;
}
}