for example i took file contain an values
123
321
231
132
like so many sequence values, i have to read these values and store it in double dimensional array and finally display that array content how can i do that please help me to sort this problem
this is code till now i able to develop
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ConsoleApplication12
{
class Program
{
static void Main()
{
String line;
try
{
double[,] sh=new double[3,1];
//Pass the file path and file name to the StreamReader constructor
StreamReader sr = new StreamReader(@"D:\input.txt");
//Read the first line of text
line = sr.ReadLine();
//Continue to read until you reach end of file
while (line != null)
{
//write the line to console window
sh = Double.TryParse(line);
// Console.WriteLine(line);
line = sr.ReadLine();
}
//close the file
sr.Close();
Console.ReadLine();
}
catch (Exception e)
{
Console.WriteLine("Exception: " + e.Message);
}
finally
{
Console.WriteLine("Executing finally block.");
}
}
but i am getting error, while assigning input value to double dimensional array
This post has been edited by CodingSup3rnatur@l-360: 02 January 2012 - 03:55 AM

New Topic/Question
Reply



MultiQuote





|