Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2015
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. public static class Program
  4. {
  5. static void Main()
  6. {
  7. string file="marks2D.txt";
  8. string outfile="average.csv";
  9. StreamReader sr= new StreamReader(file);
  10. StreamWriter outstream= new StreamWriter(outfile);
  11. //double[] field=new double [0];
  12. string[,] temp=new string[5,6];
  13. int num=0;
  14. double ave=0;
  15. for(int i=0; i<temp.GetLength(0); i++)
  16. {
  17. double sum=0;
  18. string line=sr.ReadLine();
  19. //temp=line.Split(',');
  20. for(int j=0; j<temp.GetLength(1); j++)
  21. {
  22. double m=double.Parse(line);
  23. ave = m/5;
  24. temp[num]=line;
  25. outstream.WriteLine(ave);
  26. //Console.Write("{0,1}", temp[i,j]);
  27. }
  28. outstream.WriteLine(field[num]);
  29. }
  30. Console.WriteLine();
  31. sr.Close();
  32. outstream.Close();
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement