VB.NET 小程序 4
2018-06-18 01:53:51来源:未知 阅读 ()
Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Label1.Text = "原始矩阵:" Label2.Text = "鞍点坐标:" Dim N, M, i, j, k As Integer N = InputBox("请输入矩阵行数", "输入") M = InputBox("请输入矩阵列数", "输入") Dim a(N, M) As Integer Randomize() '初始化原始矩阵 For i = 1 To N For j = 1 To M a(i, j) = (Rnd() * 20) Next Next '输出原始矩阵到Lable1 Label1.Text = Label1.Text & Chr(13) & Chr(10) For i = 1 To N For j = 1 To M Label1.Text = Label1.Text & a(i, j) & " " Next Label1.Text = Label1.Text & Chr(13) & Chr(10) Next '定义数组以存储行最大值,列最小值位置 Dim line(N, M + 1), list(N + 1, M) As Integer For i = 1 To N For j = 1 To M line(i, j) = 0 list(i, j) = 0 Next Next '找每行最大值,并将位置记入line矩阵中 Dim max As Integer = 0 For i = 1 To N For k = 2 To M max = 1 If a(i, max) < a(i, k) Then max = k End If Next line(i, k) = 1 Next '找每列最小值,并将位置记入list中 Dim min As Integer = 0 For j = 1 To M For k = 2 To N min = 1 If a(min, j) > a(k, j) Then min = k End If Next list(k, j) = 1 Next '判断鞍点 Dim u As Integer = 0 For i = 1 To N For j = 1 To M While line(i, j) And list(i, j) Label2.Text = Label2.Text & " " & "(" & i & "," & j & ")" u += 1 End While Next Next If u = 0 Then Label2.Text = Label2.Text & "此矩阵没有鞍点" End If End Sub End Class
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
下一篇:图片检测
- C语言程序结构 2020-05-31
- ftp客户端封装 2020-05-10
- C代做 C++代做 C++编程代做 C++程序代做 2020-04-29
- 测量C++程序运行时间 2020-04-17
- vscode C++ 程序 windows 2020-03-17
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash