资源简介
C# 0/1背包问题 过程演示 源码。比较简单,但是网上在此之前好像没出现过。

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace _1背包问题过程演示
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int Bag_Volume;
int[] Obj_Size Obj_Price;
int[] Result_Rec;
string[] str_Obj_Sizestr_Obj_Price;
//List Obj_Size=new List() Obj_Price=new List();//可变数组差点把我逼到用泛型的地步
//List> Result=new List>();
//List str_Obj_Size=new List()str_Obj_Price=new List();
private void Form1_Load(object sender EventArgs e)
{
ToolTip myToolTip = new ToolTip();
myToolTip.SetToolTip(txB_Bag “原则上不超过100绝对不能为负数“);
myToolTip.SetToolTip(txB_ObjSize “与下面的单价对号入座“);
myToolTip.SetToolTip(txB_ObjPrice “与上面的体积对号入座“);
}
private void btn_01Bag_Click(object sender EventArgs e)
{
#region 判断合法输入并转化成数字串
if (!txB_ObjSize.Text.Trim().Contains(““))
{
MessageBox.Show(“unchallenging!自己解决“);
return;
}
else
{
str_Obj_Size=txB_ObjSize.Text.Trim().Split(‘‘);
}
if (!txB_ObjPrice.Text.Trim().Contains(““))
{
MessageBox.Show(“unchallenging!自己解决“);
return;
}
else
{
str_Obj_Price = txB_ObjPrice.Text.Trim().Split(‘‘);
}
if (str_Obj_Size.Length != str_Obj_Price.Length)
{
ErrorProvider myErrorProvider = new ErrorProvider();
myErrorProvider.SetError(txB_ObjPrice “跟你说了物品体积和单价要对号个数也要相同啊“);
return;
}
Obj_Size = new int[str_Obj_Size.Length]; //居然可以用变量实例化直接数组[变量长度]是不行的
Obj_Price = new int[str_Obj_Price.Length];
for (int j = 0; j < str_Obj_Size.Length; j++)
{
try
{
Obj_Size[j] = Convert.ToInt32(str_Obj_Size[j]);
}
catch (Exception ex)
{
MessageBox.Show(“错误出在\“物品体积\““ + ex.Message);
return;
}
try
{
Obj_Price[j] = Convert.ToInt32(str_Obj_Price[j]);
}
catch (Exception ex)
{
MessageBox.Show(“错误出在\“物品单价\““ + ex.Message);
return;
}
}
try
{
Bag_Volume = Convert.ToInt32(txB_Bag.Text.Trim());
}
catch (Exception ex)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 967 2008-12-25 19:51 01背包问题过程演示\01背包问题过程演示.sln
..A..H. 15360 2009-07-05 08:59 01背包问题过程演示\01背包问题过程演示.suo
文件 3259 2008-12-25 20:05 01背包问题过程演示\01背包问题过程演示\01背包问题过程演示.csproj
文件 9968 2008-12-29 16:45 01背包问题过程演示\01背包问题过程演示\Form1.Designer.cs
文件 5814 2008-12-29 16:45 01背包问题过程演示\01背包问题过程演示\Form1.resx
文件 496 2008-12-25 19:51 01背包问题过程演示\01背包问题过程演示\Program.cs
文件 2881 2008-12-25 19:51 01背包问题过程演示\01背包问题过程演示\Properties\Resources.Designer.cs
文件 5612 2008-12-25 19:51 01背包问题过程演示\01背包问题过程演示\Properties\Resources.resx
文件 1111 2008-12-25 19:51 01背包问题过程演示\01背包问题过程演示\Properties\Settings.Designer.cs
文件 249 2008-12-25 19:51 01背包问题过程演示\01背包问题过程演示\Properties\Settings.settings
文件 1313 2009-07-05 08:59 01背包问题过程演示\01背包问题过程演示\Properties\AssemblyInfo.cs
文件 1185 2009-07-05 08:59 01背包问题过程演示\01背包问题过程演示\obj\01背包问题过程演示.csproj.FileListAbsolute.txt
文件 24576 2009-07-05 08:59 01背包问题过程演示\01背包问题过程演示\obj\Debug\01背包问题过程演示.exe
文件 36352 2009-07-05 08:59 01背包问题过程演示\01背包问题过程演示\obj\Debug\01背包问题过程演示.pdb
文件 180 2008-12-29 16:45 01背包问题过程演示\01背包问题过程演示\obj\Debug\_1背包问题过程演示.Form1.resources
文件 180 2008-12-25 20:05 01背包问题过程演示\01背包问题过程演示\obj\Debug\_1背包问题过程演示.Properties.Resources.resources
文件 842 2009-07-05 08:57 01背包问题过程演示\01背包问题过程演示\obj\Debug\01背包问题过程演示.csproj.GenerateResource.Cache
文件 24576 2009-07-05 08:59 01背包问题过程演示\01背包问题过程演示\bin\Debug\01背包问题过程演示.exe
文件 36352 2009-07-05 08:59 01背包问题过程演示\01背包问题过程演示\bin\Debug\01背包问题过程演示.pdb
文件 5632 2005-09-23 06:56 01背包问题过程演示\01背包问题过程演示\bin\Debug\01背包问题过程演示.vshost.exe
文件 9299 2009-07-05 08:59 01背包问题过程演示\01背包问题过程演示\Form1.cs
目录 0 2008-12-29 17:01 01背包问题过程演示\01背包问题过程演示\obj\Debug\TempPE
目录 0 2008-12-29 17:01 01背包问题过程演示\01背包问题过程演示\obj\Debug\Refactor
目录 0 2008-12-29 17:01 01背包问题过程演示\01背包问题过程演示\obj\Debug
目录 0 2008-12-29 17:01 01背包问题过程演示\01背包问题过程演示\bin\Debug
目录 0 2008-12-29 17:01 01背包问题过程演示\01背包问题过程演示\Properties
目录 0 2008-12-29 17:01 01背包问题过程演示\01背包问题过程演示\obj
目录 0 2008-12-29 17:01 01背包问题过程演示\01背包问题过程演示\bin
目录 0 2008-12-29 17:01 01背包问题过程演示\01背包问题过程演示
目录 0 2008-12-29 17:01 01背包问题过程演示
............此处省略3个文件信息
- 上一篇:winform制作windows普通计算器
- 下一篇:RegExBuilder
相关资源
- C#解析HL7消息的库135797
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
评论
共有 条评论