using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
System.Windows.Forms.Button[] Buttons;
System.Windows.Forms.TextBox[] textBoxes;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int[,] a = new int[5, 5];
int[,] b = new int[5, 5];
int[,] c = new int[5, 5];
int m, n;
m = 5;
n = 5;
a[1, 1] = 1;
a[1, 2] = 0;
a[1, 3] = 0;
a[1, 4] = 0;
a[2, 1] = 0;
a[2, 2] = 1;
a[2, 3] = 0;
a[2, 4] = 0;
a[3, 1] = 0;
a[3, 2] = 0;
a[3, 3] = 1;
a[3, 4] = 0;
a[4, 1] = 0;
a[4, 2] = 0;
a[4, 3] = 0;
a[4, 4] = 1;
b[1, 1] = 1;
b[1, 2] = 0;
b[1, 3] = 0;
b[1, 4] = 0;
b[2, 1] = 0;
b[2, 2] = 1;
b[2, 3] = 0;
b[2, 4] = 0;
b[3, 1] = 0;
b[3, 2] = 0;
b[3, 3] = 1;
b[3, 4] = 0;
b[4, 1] = 0;
b[4, 2] = 0;
b[4, 3] = 0;
b[4, 4] = 1;
for (int i = 1; i < m; i++)
{
for (int j = 1; j < n; j++)
{
for (int k = 1; k < m; k++)
{
c[i, j] = c[i, j] + a[i, k] * b[k, j];
}
Console.WriteLine("c[" + i + "," + j + "]=" + c[i, j]);
}
}
Console.WriteLine("ans");
Console.Read();
}
private void Form1_Load(object sender, EventArgs e)
{
textBoxes = new System.Windows.Forms.TextBox[16];
for (int i = 0; i < 16; i++)
{
textBoxes[i] = new TextBox();
this.Controls.Add(textBoxes[i]);
if (i <= 3)
textBoxes[i].Location = new System.Drawing.Point(10 + i * 80, 10);
else if (i > 3 && i <= 7)
textBoxes[i].Location = new System.Drawing.Point(10 + (i - 4) * 80, 40);
else if (i > 7 && i <= 11)
textBoxes[i].Location = new System.Drawing.Point(10 + (i - 8) * 80, 70);
else if (i > 11 && i <= 15)
textBoxes[i].Location = new System.Drawing.Point(10 + (i - 12) * 80, 100);
}
textBoxes = new System.Windows.Forms.TextBox[16];
for (int i = 0; i < 16; i++)
{
textBoxes[i] = new TextBox();
this.Controls.Add(textBoxes[i]);
if (i <= 3)
textBoxes[i].Location = new System.Drawing.Point(400 + i * 80, 10);
else if (i > 3 && i <= 7)
textBoxes[i].Location = new System.Drawing.Point(400 + (i - 4) * 80, 40);
else if (i > 7 && i <= 11)
textBoxes[i].Location = new System.Drawing.Point(400 + (i - 8) * 80, 70);
else if (i > 11 && i <= 15)
textBoxes[i].Location = new System.Drawing.Point(400 + (i - 12) * 80, 100);
}
Buttons = new System.Windows.Forms.Button[16];
for (int i = 0; i < 16; i++)
{
Buttons[i] = new Button();
this.Controls.Add(Buttons[i]);
if (i <= 3)
Buttons[i].Location = new System.Drawing.Point(10 + i * 80, 200);
else if (i > 3 && i <= 7)
Buttons[i].Location = new System.Drawing.Point(10 + (i - 4) * 80, 240);
else if (i > 7 && i <= 11)
Buttons[i].Location = new System.Drawing.Point(10 + (i - 8) * 80, 270);
else if (i > 11 && i <= 15)
Buttons[i].Location = new System.Drawing.Point(10 + (i - 12) * 80, 300);
}
}
}
}
(System.Windows.Forms.TextBox[] textBoxes;)要有A和B
沒有留言:
張貼留言