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
{
Form2 newform;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int a1,an,d,n,sn;
a1 =int.Parse (textBox1.Text);
d = int.Parse(textBox2.Text);
n = int.Parse(textBox3.Text);
an = a1 + (n - 1) * d;
sn = (a1 + an) * n / 2;
textBox4.Text =""+an;
textBox5.Text =""+sn;
}
private void label3_Click(object sender, EventArgs e)
{
}
private void label4_Click(object sender, EventArgs e)
{
}
private void label5_Click(object sender, EventArgs e)
{
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
newform = new Form2();
newform.Show();
}
}
}
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 Form2 : Form
{
Form2 newform;
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int sum = 0;
int[,] arr1 = new int[82, 82];
for (int i = 1; i <= 9; i++)
{
for (int j = 1; j <= 9; j++)
{
sum = i * j;
arr1[i, j] = sum;
}
}
for (int i = 1; i <= 9; i++)
{
for (int j = 1; j <= 9; j++)
{
listBox1.Items.Add("" + i + "*" + "" + j + "=" + arr1[i, j]);
}
}
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}
沒有留言:
張貼留言