PLease can someone help? I need to create a program that reads a list of units and names "eg ounce,gram,28" then asks for a user input, and then converts and displays the result. So far all i have been able to do is get it to read the first line, but nothing else.
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace Soft140AssPt3V2
{
class Program
{
static void Main(string[] args)
{
Main:
string line, Start, Finish, j, l;
double Factor, Output, Amount;
string[] SplitData = new string [2];
StreamReader Units = new StreamReader("../../convert.txt");
while ((line = Units.ReadLine()) != null)
{
SplitData = line.Split(',');
Start = SplitData[0];
Finish = SplitData[1];
Factor = Convert.ToDouble(SplitData[2]);
//Get inputs
Console.WriteLine("Please input the amount, to and from type (Ex. 5,ounces,grams):");
string Input = Console.ReadLine();
string[] Measurements = Input.Split(',', ' ', '/', '.');
Amount = Convert.ToDouble(Measurements[0]);
j = Measurements[1];
l = Measurements[2];
if (j == Start)
{
Output = (Factor * Amount);
Console.WriteLine("{0} {1} equals {2} {3}", Amount, Measurements[1], Output, Measurements[2]);
Console.ReadLine();
goto Main;
}
else
{
}
}
Units.Close();
}
}
}