| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 487 人关注过本帖
标题:[求助]盗窃犯问题?
取消只看楼主 加入收藏
fengfei0210
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2007-10-10
收藏
 问题点数:0 回复次数:0 
[求助]盗窃犯问题?
盗窃犯问题:张某被盗,公安局派出5个侦察员去调查.研究案情时,第一个侦察员说"A与B至少有一人是盗窃犯";第二个侦察员说"B与C至少有一人是盗窃犯";第三个侦察员说"C与D至少有一人是盗窃犯";第四个侦察员说"A与C中至少有一人不是盗窃犯";第五个侦察员说"B与D至少有一人不是盗窃犯".如果这些侦察员的话都是可靠的,编程求谁是真正的盗窃犯.
程序如下:Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer, d As Integer
Dim c1 As Integer, c2 As Integer, c3 As Integer, c4 As Integer, c5 As Integer
For a = 0 To 1
For b = 0 To 1
For c = 0 To 1
For d = 0 To 1
c1 = a Or b
c2 = b Or c
c3 = c Or d
c4 = Not a Or Not c
c5 = Not b Or Not d
If (c1 And c2 And c3 And c4 And c5) Then
If (a = 1) Then
Text1.Text = "是"
Else
Text1.Text = "否"
If (b = 1) Then
Text2.Text = "是"
Else
Text2.Text = "否"
If (c = 1) Then
Text3.Text = "是"
Else
Text3.Text = "否"
If (d = 1) Then
Text4.Text = "是"
Else
Text4.Text = "否"
End If
End If
Next d
Next c
Next b
Next a
End Sub
但是运行程序的时候,出现"编译错误:next 没有 for"的提示,这是为什么?
搜索更多相关主题的帖子: 盗窃犯 
2007-10-17 07:36
快速回复:[求助]盗窃犯问题?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016899 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved