0
我有这样的txt数据:列在多维数组C#
跳蚤,0,0,1,0,0,0,0,0,0,1,0,0,6,0, 0,0,6
青蛙,0,0,1,0,0,1,1,1,1,1,0,0,4,0,0,0,5
青蛙, 0,0,1,0,0,1,1,1,1,1,1,0,4,0,0,0,5
我需要计算选定列中零的数量,例如在第一列中有3个零。
这里是我到目前为止的代码:
//data patch
string[] tekst = File.ReadAllLines(@"C:\zoo.txt");
//full of array
string[] tablica = tekst;
for(int s=0;s<tablica.Length;s++)
{
Console.WriteLine(tablica[s]);
}
//----------------Show all of array---------------------------//
//----------------Giv a number of column-----------------////
Console.WriteLine("Podaj kolumne");
int a = Convert.ToInt32(Console.ReadLine());
//Console.WriteLine("Podaj wiersz");
//int b = Convert.ToInt32(Console.ReadLine());
int n = tablica.Length;
int m = tablica[a].Split(',').Length;
string[,] liczby = new string[n, m];
for (int j = 0; j < n; j++)
{
int suma = 0;
for (int i = 0; i < m; i++)
{
//somethink should be here
}
}
解决这个任何想法?
您尝试过什么吗?你有什么问题? – astidham2003
请将文字视为文字,而不是图像。 –
我不知道如何计算这个零,因为你看到我不知道怎么把第二个()和txt添加为文本 – Domi