Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp2
- {
- class Program
- {
- static void Main(string[] args)
- {
- string s = System.IO.File.ReadAllText(@"data.txt");
- s += " ";
- string t = "";
- string n = "";
- for (int i = 0;i < s.Length; i++)
- {
- if(s[i] == '.')
- {
- t += ",";
- }
- else
- {
- t += s[i];
- }
- }
- double[,] a = new double[1000, 3];
- int x = 0;
- int y = 0;
- for(int i = 0;i < t.Length;i++)
- {
- if (t[i] >= '0' && t[i] <= '9' || t[i] == ',')
- {
- n += t[i];
- }
- else
- {
- if (n.Length != 0)
- {
- a[x, y] = Convert.ToDouble(n);
- y++;
- if (y == 3)
- {
- y = 0;
- x++;
- }
- n = "";
- }
- }
- }
- for (int i = 0; i < x; i++)
- {
- Console.Write(a[i, 0]);
- Console.Write(" ");
- Console.Write(a[i, 1]);
- Console.Write(" ");
- Console.WriteLine(a[i, 2]);
- }
- Console.ReadKey();
- }
- }
- }
Add Comment
Please, Sign In to add comment