LAMPIRAN
LISTING PROGRAM
using System;
using System.Collections.Generic; using System.ComponentModel; using System.Data;
using System.Drawing; using System.Linq; using System.Text;
using System.Threading.Tasks; using System.Windows.Forms; using System.Diagnostics;
namespace WindowsFormsApplication2 {
public partial class Form3 : Form {
public Form3() {
InitializeComponent(); }
private void button1_Click(object sender, EventArgs e) {
int N = 15; int IN = 9999;
int[,] cost;
cost = new int[,] {
{ 9999, 450, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 2200 }, { 9999, 9999, 1300, 9999, 9999, 9999, 9999, 9999, 9999, 2700, 9999, 9999, 9999, 9999, 9999 }, { 9999, 9999, 9999, 260, 650, 9999, 9999,
9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999 },
{ 9999, 9999, 9999, 9999, 9999, 650, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999 }, { 9999, 9999, 9999, 650, 9999, 600, 9999,
9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999 },
A-4
start = target; j = 0;
while (start != -1) {
//start = start+65;
path_kantor[j] = kantor[start];
path[j++] = Convert.ToChar(start + 65); start = prev[start];
}
Array.Reverse(path);
Array.Reverse(path_kantor);
DataTable dt = new DataTable();
dt.Columns.Add("Titik", typeof(char)); dt.Columns.Add("Kantor", typeof(string)); DataRow dr;
for (i = N - j; i < N; i++) {
dr = dt.NewRow(); dr["Titik"] = path[i];
dr["Kantor"] = path_kantor[i]; dt.Rows.Add(dr);
}
dataGridView1.DataSource = dt;
textBox1.Text = dist[target].ToString();