Входная строка имела неверный формат - C# (186719)
Формулировка задачи:
while (true)
{
Thread.Sleep(1);
Random rand = new Random(DateTime.Now.Millisecond);
Int64 a = rand.Next(2, 999);
Int64 b = rand.Next(2, 999);
Int64 c = rand.Next(2, 999);
Int64 d = rand.Next(2, 999);
String A = Convert.ToString(a);
String B = Convert.ToString(b);
String C = Convert.ToString(c);
String D = Convert.ToString(d);
Int64 result = Convert.ToInt64(A) * (4 * Convert.ToInt64(B)) * Convert.ToInt64(C) * (Convert.ToInt64(D) * Convert.ToInt64(D));
String Resultat = A + "x(4x" + B + ")x" + C + "x" + "(" + D + "x" + D + ")" + "=" + result;
Int64 aa = rand.Next(2, 999);
Int64 bb = rand.Next(2, 999);
Int64 cc = rand.Next(2, 999);
String AA = Convert.ToString(aa);
String BB = Convert.ToString(bb);
String CC = Convert.ToString(cc);
Int64 DD = Convert.ToInt64(BB) * Convert.ToInt64(BB) - 4 * Convert.ToInt64(AA) * Convert.ToInt64(CC);
String DDResult1 = Convert.ToString(DD);
double Root = Convert.ToDouble(DDResult1);
Root = Math.Sqrt(Root);
String DDRoot = Root.ToString();
String DR1 = AA + "Yx" + AA + "Y+" + BB + "+" + CC + "=0";
String DR2 = "Square root D=" + DDRoot;
Int64 RR1 = -Convert.ToInt64(BB) + Convert.ToInt64(DDRoot) / 2 * Convert.ToInt64(AA);
Int64 RR2 = -Convert.ToInt64(BB) - Convert.ToInt64(DDRoot) / 2 * Convert.ToInt64(AA);
String RR1S = Convert.ToString(RR1);
String RR2S = Convert.ToString(RR2);
StreamWriter sw1 = new StreamWriter("output.math", true);
sw1.WriteLine(Resultat);
sw1.WriteLine("D=" + DDResult1);
sw1.WriteLine(DR1);
sw1.WriteLine(DR2);
sw1.WriteLine("Y1=" + RR1S);
sw1.WriteLine("Y2=" + RR2S);
sw1.Close();
} Int64 RR1 = -Convert.ToInt64(BB) + Convert.ToInt64(DDRoot) / 2 * Convert.ToInt64(AA);
Int64 RR2 = -Convert.ToInt64(BB) - Convert.ToInt64(DDRoot) / 2 * Convert.ToInt64(AA);Решение задачи: «Входная строка имела неверный формат»
textual
Листинг программы
Int64 RR1 = -bb + (Int64)Root / 2 * aa; Int64 RR2 = -bb - (Int64)Root / 2 * aa;