Исправить код программы - C#
Формулировка задачи:
помогите пожалуйста исправить код
class Program
{
static void Main(string[] args)
{
Double x1,x2,x3,x4,y1,y2,y3,y4;
String s;
Console.Write("Введите координаты х1\n");
Console.Write("Введите х - ");
s = Console.ReadLine();
x1 = Convert.ToDouble(s);
Console.Write("Введите y - ");
s = Console.ReadLine();
y1 = Convert.ToDouble(s);
Console.Write("Введите координаты х2\n");
Console.Write("Введите х - ");
s = Console.ReadLine();
x2 = Convert.ToDouble(s);
Console.Write("Введите y - ");
s = Console.ReadLine();
y2 = Convert.ToDouble(s);
Console.Write("Введите координаты х3\n");
Console.Write("Введите х - ");
s = Console.ReadLine();
x3 = Convert.ToDouble(s);
Console.Write("Введите y - ");
s = Console.ReadLine();
y3 = Convert.ToDouble(s);
if (x1 == x2) x4 = x3;
else if (x1 == x3) x4 = x2;
else Console.WriteLine("некорректно заданы координаты");
if (y1 == y3) y4 = y2;
else if (y1 == y2) y4 = y2;
else Console.WriteLine("некорректно заданы координаты");
Console.WriteLine("{0},{1}", x4,y4);
Console.ReadLine();
}
}
}Решение задачи: «Исправить код программы»
textual
Листинг программы
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
Double x1, x2, x3, x4, y1, y2, y3, y4;
String s;
Console.Write("Введите координаты 1\n");
Console.Write("Введите х - ");
s = Console.ReadLine();
x1 = Convert.ToDouble(s);
Console.Write("Введите y - ");
s = Console.ReadLine();
y1 = Convert.ToDouble(s);
Console.Write("Введите координаты 2\n");
Console.Write("Введите х - ");
s = Console.ReadLine();
x2 = Convert.ToDouble(s);
Console.Write("Введите y - ");
s = Console.ReadLine();
y2 = Convert.ToDouble(s);
Console.Write("Введите координаты 3\n");
Console.Write("Введите х - ");
s = Console.ReadLine();
x3 = Convert.ToDouble(s);
Console.Write("Введите y - ");
s = Console.ReadLine();
y3 = Convert.ToDouble(s);
Console.Write("Введите координаты 4\n");
Console.Write("Введите х - ");
s = Console.ReadLine();
x4 = Convert.ToDouble(s);
Console.Write("Введите y - ");
s = Console.ReadLine();
y4 = Convert.ToDouble(s);
if (x1 == x2) x4 = x3;
else if (x1 == x3) x4 = x2;
else Console.WriteLine("некорректно заданы координаты x");
if (y1 == y3) y4 = y2;
else if (y1 == y2) y4 = y2;
else Console.WriteLine("некорректно заданы координаты y");
Console.WriteLine("{0},{1}", x4, y4);
Console.ReadLine();
}
}
}