课程表转换成二维表
『壹』 asp使用二维数组制作一张课程表
<%
Dim kb(6,7) '第一维表示周几来,第二维自表示第几堂课
'自己给kb数组赋值
Response.Write "<table>"
Response.Write "<tr><td></td><td>周一</td><td>周二</td><td>周三</td><td>周四</td><td>周五</td><td>周六</td><td>周日</td></tr>"
Dim i, j
For i = 0 To 7
Response.Write "<tr><td>第" & i + 1 & "堂</td>"
For j = 0 To 6
Response.Write "<td>" & kb(j,i) & "</td>"
Next
Response.Write "</tr>"
Next
Response.Write "</table>"
%>
『贰』 C# 把课表定义为二维数组,输出出来.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication6
{
class Program
{
static void Main(string[] args)
{
Console.Write("请输入动态数组的行数:");
int row = Convert.ToInt32(Console.ReadLine());
Console.Write("请输入动态数组的列数:");
int col = Convert.ToInt32(Console.ReadLine());
int[,] arr = new int[row, col];
Console.WriteLine("结果:");
for(int i=0;i<row;i++)
{