using System; namespace IntDoubleString { class IntDoubleString { static void Main() { decimal InputType; Console.WriteLine("Please choose a type: \n1 --> int \n2 --> double \n3 --> string: "); while (!decimal.TryParse(Console.ReadLine(), out InputType) || (InputType != 1 && InputType != 2 && InputType !=3 )) // using VAR TYPE Decimal and the OR (input !=#) to make sure that only 1,2 AND 3 are accepted as proper input, otherwise prompts again. { Console.WriteLine("Please enter proper integer: "); } switch ((int)InputType) { case 1: int CaseInt; Console.WriteLine("Please enter a integer: "); while (!int.TryParse(Console.ReadLine(), out CaseInt)) //gotta make sure that a proper integer is entered. { Console.WriteLine("Please enter proper integer: "); } Console.WriteLine("{0}", CaseInt+1); break; case 2: double CaseDouble; Console.WriteLine("Please enter a double: "); while (!double.TryParse(Console.ReadLine(), out CaseDouble)) { Console.WriteLine("Please enter proper double: "); } Console.WriteLine("{0}", CaseDouble+1.00); break; case 3: Console.WriteLine("Please enter a string: "); string CaseString = Console.ReadLine(); Console.WriteLine("{0}", CaseString+"*"); //because it is a string, i do not know of a way to break somehow the input. even an empty input on String type outputs *. break; default: Console.WriteLine("Wrong input"); //not really needed, but just in case if you manage somehow to break the program and manage to escape from all other cases and statements. break; } } } }