課程表轉換成二維表
『壹』 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++)
{