【发布时间】:2016-08-15 06:22:38
【问题描述】:
我需要将该表中的数据放入一个数组中,然后将该数组打印为控制台中的格式化表。 这是我从http://puu.sh/oqV8f/7d982f2665.jpg 获得数据的表格;我只需要使数组输出行和列而不是列表。 到目前为止我有这个:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Zumba1
{
class Zumba
{
static void Main(string[] args)
{ //Recreated the data in the table for the zumba section, added each row, and each column.
string[,] schedule = new string [8, 6] { { "1:00", "3:00", "5:00", "7:00", "TOTAL", "", },
{"Monday", "12", "10", "17", "22", "244", },
{"Tuesday", "11", "13", "17", "22", "252",},
{"Wednesday", "12", "10", "22", "22", "264",},
{"Thursday", "9", "14", "17", "22", "248",},
{"Friday", "12", "10", "21", "12", "220",},
{"Saturday", "12", "10", "5", "10", "148"},
{" ", " ", " ", " ", " ","1376",}};
foreach (string i in schedule)
{
Console.WriteLine(i.ToString());
}
Console.ReadKey();
}
}
}
有什么想法吗?
【问题讨论】:
-
你卡在哪里了?
-
你有一个二维数组,你想把它做成一个表格?什么样的桌子? html表?数据库表?
-
有什么问题?将数据库表转换为二维字符串数组?或者在控制台中对齐一个二维数组?