I'm having problems with my console input. Code is:
using System;
using System.Linq;
class Training
{
static void Main()
{
double[] arr = Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
int[] roundedNums = new int[arr.Length];
for (int i = 0; i < arr.Length; i++)
{
roundedNums[i] = (int)Math.Round(arr[i], MidpointRounding.AwayFromZero);
}
for (int i = 0; i < roundedNums.Length; i++)
{
Console.WriteLine("{0} => {1}", arr[i], roundedNums[i]);
}
}
}
When i start the program i get an exception if i use . instead of , (example: if I type 3.5 i get an error, but if I type 3,5 the program works fine). I'm using Visual Studio Community 2015.
How can i solve this?