Jumping out of the loop and list
Let us say input for the while(true) is x and y coordinates. As long as user provide x and y coordinates loop will continue. Any keystroke will terminate the loop and list relevant x and y coordinates. Following is an incomplete program please complete it.
using System;
class Program
{
static void Main(string[] args)
{
int i = 0;
while (true)
{
Console.Write("X = ");
double x = int.Parse(Console.ReadLine());
Console.Write("Y = ");
double y = int.Parse(Console.ReadLine());
Console.WriteLine();
i++;
}
x[i] = x;
y[i] = y;
double[] x = new double[i];
double[] y = new double[i];
Console.WriteLine("X Y");
Console.ReadKey();
}
}