There is such a code for a simple currency converter. ( SOM is the currency of Kyrgyzstan)
using System; namespace modConvertUSDRU { class Program { static void Main(string[] args) { Console.WriteLine("Hello\n"); Console.WriteLine("Введите 1 если USD/SOM или 2 если SOM/USD"); double ENTER = Convert.ToDouble(Console.ReadLine()); switch (ENTER) { case 1: ConvrtRUUSD(); break; case 2: ConverUSDRU(); break; } } static void ConverUSDRU() { double convertUSRU; Console.WriteLine("Введите сумму в сомах: "); double RU = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Введите курс USD: "); double USD = Convert.ToDouble(Console.ReadLine()); convertUSRU = RU / USD; Console.WriteLine("Сумма равна {0} $.", convertUSRU); } static void ConvrtRUUSD() { double convertUSRU; Console.WriteLine("Введите сумму в USD: "); double USDSUM = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Введите курс USD: "); double USDK = Convert.ToDouble(Console.ReadLine()); convertUSRU = USDSUM * USDK; Console.WriteLine("Сумма равна {0} сом.", convertUSRU); } } } do not look at beauty is just an example!
The question is the following: Why when entering for example (16000) everything works when entering (16,000) too, but when entering (16.000) it gives this error
Unhandled Exception: System.FormatException: The input string was not correct.
at System.Number.ParseDouble (String value, NumberStyles options, NumberFormatInfo numfmt)
at modConvertUSDRU.Program.ConverUSDRU () in D: \ MailCloud \ C # \ CS2017WORK \ modConvertUSDRU \ Program.cs: line 32
at modConvertUSDRU.Program.Main (String [] args) in D: \ MailCloud \ C # \ CS2017WORK \ modConvertUSDRU \ Program.cs: line 20 *
I understand that there may be a conflict in some kind of exception or there is a conjecture in the conflict (string / double), but where I can not understand the error!
esculture, or a semicolon value intoenculture. - EvgeniyZ