| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3505 人关注过本帖
标题:求助!找出给定范围内的佩服数编程
只看楼主 加入收藏
ZL张琳
Rank: 1
来 自:浙江省
等 级:新手上路
帖 子:5
专家分:0
注 册:2016-4-22
结帖率:100%
收藏
已结贴  问题点数:10 回复次数:5 
求助!找出给定范围内的佩服数编程
在一个整数的所有真因子(除了本身之外的所有因子)中,若存在一个因子d`,将不是d`的所有因子相加求和,再减掉d`,若等于这个数本身,则称该数为佩服数。
例如:12的所有真因子是1、2、3、4、6;12=1+3+4+6-2,因此12是一个佩服数。
下面是书上的编程,求大神完善补充,万分感谢!!!
Option Explicit
Option Base 1

Private Sub Command1_Click()
     Dim I As Integer, S As Integer, F() As Integer
     Dim A As Integer, B As Integer
     A = Text1
     B = Text2
     For I = A To B
         Call Yz(I, F)
         If verify(I, F, S) Then
             list1.AddItem I & " = " & S
        End If
    Next I
End Sub


Private Sub Yz(N As Integer, F() As Integer)
     Dim I As Integer, K As Integer
     For I = 1 To N - 1
     if  then
     
     ReDim Preserve F(K)

        End If
    Next I
End Sub


Private Function verify(N As Integer, F() As Integer, St As String) As Boolean
     Dim I As Integer, K As Integer, Sum As Integer, J As Integer
     For I = 1 To UBound(F)
         Sum = 0
           
        For J = 1 To UBound(F)
            If J <> 1 Then
            
               St = St & F(J) & "+"
            End If
        Next J
        If N = Sum - F(I) Then
      
            St = Left(St, Len(St) - 1) & "-" & F(I)
            Exit Function
        End If
    Next I
End Function
搜索更多相关主题的帖子: Text1 Text2 
2016-04-23 19:17
风吹过b
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:364
帖 子:4947
专家分:30084
注 册:2008-10-15
收藏
得分:10 
程序代码:
Option Explicit

Private Sub Command1_Click()

Dim A As Long
A = Int(Val(Text1.Text))        '转数值,然后取整,不要小数

Dim s As String

Call verify(A, s)               '不要返回值的调用,和 调用 sub 一样

Text2.Text = s

End Sub

Public Function verify(A As Long, ByRef s As String) As Boolean
'S显式申明按地址传递,也就是修改S值,会导致调用者内容修改

Dim i As Long, o As Long
Dim j As Long                   'j为因子数计数
Dim m() As Long                 '保存各个因子
Dim sumA As Long                '各因子和

verify = False

If A > 0 Then                   '负数不算,0不算
    ReDim m(A / 2)              '最大因子个数是 A/2
    
    j = 1                       '1永远是真因子,所以最少有一个因子
    m(1) = 1                    '第一个因子
    sumA = 1                    '各因子和
    
    For i = 2 To A / 2
        If A / i = Int(A / i) Then '如果能整除
            j = j + 1           '因子个数计数
            m(j) = i            '保存因子
            sumA = sumA + i     '同时因子求和
        End If
    Next i
    
    For i = 1 To j              '开始测试
        '若存在一个因子d`,将不是d`的所有因子相加求和,再减掉d`,若等于这个数本身
        If sumA - m(i)  - m(i) = A Then '如果和减掉因子本身,再减去因子
            For o = 1 To j
                If o <> i Then                  '因子本身不能组合进去
                    s = s & " + " & m(o)        '拼起来
                End If
            Next o
                s = Mid(s, 4)                   '去掉最前面的 + 号
                s = A & " = " & s & " - " & m(i)
            Exit For
        End If
    Next i
    If Len(s) > 0 Then
        verify = True
    Else
        s = A & "不是佩服数。"
    End If
Else
    s = "请输入正整数。"

End If
End Function



[此贴子已经被作者于2016-4-24 22:20编辑过]


授人于鱼,不如授人于渔
早已停用QQ了
2016-04-23 20:30
风吹过b
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:364
帖 子:4947
专家分:30084
注 册:2008-10-15
收藏
得分:0 
批量测试也好办:
dim s as string
for i=A to B
    if verify(i,s) then
        'i 是,记录I 或 S
    end if
next i

授人于鱼,不如授人于渔
早已停用QQ了
2016-04-23 20:36
ZL张琳
Rank: 1
来 自:浙江省
等 级:新手上路
帖 子:5
专家分:0
注 册:2016-4-22
收藏
得分:0 
感谢大神的回复和心血!
但是,我用VB程序运行了一下子,不太对,因为12就是个佩服数,但是结果却显示“12不是佩服数”(其实菜鸟的我看的不是很懂)

VB一定过!!!
2016-04-25 17:01
风吹过b
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:364
帖 子:4947
专家分:30084
注 册:2008-10-15
收藏
得分:0 
不会吧,我用  12 测试过了。

窗体上放一个 text1,一个text2,一个 Command1

把代码全部复制进去,然后 运行,在 TEXT1 输入 12, 点按钮后,
在 TEXT2中 显示: 12 = 1 + 3 + 4 + 6 - 2
没错啊。

3楼的代码,需要修正,因为每次S都会被改变,所以你调用前,要把S置为空。

程序代码:
Dim A As Long, B As Long
Dim i As Long
Dim s As String
Dim s1 As String                '总结果,复制用

A = Int(Val(Text1.Text))        '转数值,然后取整,不要小数
B = Int(Val(Text2.Text))        '转数值,然后取整,不要小数
For i = A To B
    s = ""
    If verify(i, s) Then
        List1.AddItem s
        s1 = s1 & s & vbCrLf    '组合总结果
    End If
Next i
Text3.Text = s1                 '显示总结果,以便复制

12 = 1 + 3 + 4 + 6 - 2
20 = 2 + 4 + 5 + 10 - 1
24 = 1 + 2 + 3 + 4 + 8 + 12 - 6
30 = 1 + 2 + 3 + 5 + 10 + 15 - 6
40 = 1 + 2 + 4 + 8 + 10 + 20 - 5
42 = 1 + 2 + 3 + 7 + 14 + 21 - 6
54 = 1 + 2 + 3 + 9 + 18 + 27 - 6
56 = 1 + 2 + 7 + 8 + 14 + 28 - 4
66 = 1 + 2 + 3 + 11 + 22 + 33 - 6
70 = 1 + 5 + 7 + 10 + 14 + 35 - 2
78 = 1 + 2 + 3 + 13 + 26 + 39 - 6
84 = 1 + 2 + 3 + 4 + 6 + 7 + 12 + 14 + 21 + 42 - 28
88 = 1 + 4 + 8 + 11 + 22 + 44 - 2
102 = 1 + 2 + 3 + 17 + 34 + 51 - 6
104 = 2 + 4 + 8 + 13 + 26 + 52 - 1
114 = 1 + 2 + 3 + 19 + 38 + 57 - 6
120 = 1 + 2 + 3 + 4 + 5 + 6 + 8 + 10 + 12 + 15 + 20 + 24 + 30 + 40 - 60
138 = 1 + 2 + 3 + 23 + 46 + 69 - 6
140 = 1 + 2 + 4 + 5 + 7 + 10 + 14 + 20 + 35 + 70 - 28
174 = 1 + 2 + 3 + 29 + 58 + 87 - 6
186 = 1 + 2 + 3 + 31 + 62 + 93 - 6
222 = 1 + 2 + 3 + 37 + 74 + 111 - 6
224 = 1 + 2 + 4 + 7 + 8 + 14 + 16 + 32 + 56 + 112 - 28
234 = 1 + 2 + 3 + 6 + 9 + 13 + 18 + 26 + 78 + 117 - 39
246 = 1 + 2 + 3 + 41 + 82 + 123 - 6
258 = 1 + 2 + 3 + 43 + 86 + 129 - 6
270 = 1 + 2 + 3 + 5 + 6 + 9 + 10 + 15 + 18 + 27 + 30 + 45 + 54 + 135 - 90
282 = 1 + 2 + 3 + 47 + 94 + 141 - 6
308 = 1 + 2 + 4 + 7 + 11 + 14 + 22 + 44 + 77 + 154 - 28
318 = 1 + 2 + 3 + 53 + 106 + 159 - 6
354 = 1 + 2 + 3 + 59 + 118 + 177 - 6
364 = 1 + 2 + 4 + 7 + 13 + 14 + 26 + 52 + 91 + 182 - 28
366 = 1 + 2 + 3 + 61 + 122 + 183 - 6
368 = 1 + 2 + 8 + 16 + 23 + 46 + 92 + 184 - 4
402 = 1 + 2 + 3 + 67 + 134 + 201 - 6
426 = 1 + 2 + 3 + 71 + 142 + 213 - 6
438 = 1 + 2 + 3 + 73 + 146 + 219 - 6
464 = 2 + 4 + 8 + 16 + 29 + 58 + 116 + 232 - 1
474 = 1 + 2 + 3 + 79 + 158 + 237 - 6
476 = 1 + 2 + 4 + 7 + 14 + 17 + 34 + 68 + 119 + 238 - 28
498 = 1 + 2 + 3 + 83 + 166 + 249 - 6
532 = 1 + 2 + 4 + 7 + 14 + 19 + 38 + 76 + 133 + 266 - 28
534 = 1 + 2 + 3 + 89 + 178 + 267 - 6
582 = 1 + 2 + 3 + 97 + 194 + 291 - 6
606 = 1 + 2 + 3 + 101 + 202 + 303 - 6
618 = 1 + 2 + 3 + 103 + 206 + 309 - 6
642 = 1 + 2 + 3 + 107 + 214 + 321 - 6
644 = 1 + 2 + 4 + 7 + 14 + 23 + 46 + 92 + 161 + 322 - 28
650 = 2 + 5 + 10 + 13 + 25 + 26 + 50 + 65 + 130 + 325 - 1
654 = 1 + 2 + 3 + 109 + 218 + 327 - 6
672 = 1 + 2 + 3 + 4 + 6 + 7 + 8 + 12 + 14 + 16 + 21 + 24 + 28 + 32 + 42 + 48 + 56 + 84 + 96 + 112 + 168 + 224 - 336
678 = 1 + 2 + 3 + 113 + 226 + 339 - 6
762 = 1 + 2 + 3 + 127 + 254 + 381 - 6
786 = 1 + 2 + 3 + 131 + 262 + 393 - 6
812 = 1 + 2 + 4 + 7 + 14 + 29 + 58 + 116 + 203 + 406 - 28
822 = 1 + 2 + 3 + 137 + 274 + 411 - 6
834 = 1 + 2 + 3 + 139 + 278 + 417 - 6
836 = 1 + 2 + 11 + 19 + 22 + 38 + 44 + 76 + 209 + 418 - 4
868 = 1 + 2 + 4 + 7 + 14 + 31 + 62 + 124 + 217 + 434 - 28
894 = 1 + 2 + 3 + 149 + 298 + 447 - 6
906 = 1 + 2 + 3 + 151 + 302 + 453 - 6
942 = 1 + 2 + 3 + 157 + 314 + 471 - 6
945 = 1 + 3 + 5 + 7 + 9 + 21 + 27 + 35 + 45 + 63 + 105 + 135 + 189 + 315 - 15
978 = 1 + 2 + 3 + 163 + 326 + 489 - 6
992 = 1 + 2 + 4 + 8 + 31 + 32 + 62 + 124 + 248 + 496 - 16
1002 = 1 + 2 + 3 + 167 + 334 + 501 - 6
1036 = 1 + 2 + 4 + 7 + 14 + 37 + 74 + 148 + 259 + 518 - 28
1038 = 1 + 2 + 3 + 173 + 346 + 519 - 6
1074 = 1 + 2 + 3 + 179 + 358 + 537 - 6
1086 = 1 + 2 + 3 + 181 + 362 + 543 - 6
1146 = 1 + 2 + 3 + 191 + 382 + 573 - 6
1148 = 1 + 2 + 4 + 7 + 14 + 41 + 82 + 164 + 287 + 574 - 28
1158 = 1 + 2 + 3 + 193 + 386 + 579 - 6
1182 = 1 + 2 + 3 + 197 + 394 + 591 - 6
1194 = 1 + 2 + 3 + 199 + 398 + 597 - 6
1204 = 1 + 2 + 4 + 7 + 14 + 43 + 86 + 172 + 301 + 602 - 28
1266 = 1 + 2 + 3 + 211 + 422 + 633 - 6
1316 = 1 + 2 + 4 + 7 + 14 + 47 + 94 + 188 + 329 + 658 - 28
1338 = 1 + 2 + 3 + 223 + 446 + 669 - 6
1362 = 1 + 2 + 3 + 227 + 454 + 681 - 6
1372 = 1 + 2 + 4 + 7 + 14 + 49 + 98 + 196 + 343 + 686 - 28
1374 = 1 + 2 + 3 + 229 + 458 + 687 - 6
1398 = 1 + 2 + 3 + 233 + 466 + 699 - 6
1434 = 1 + 2 + 3 + 239 + 478 + 717 - 6
1446 = 1 + 2 + 3 + 241 + 482 + 723 - 6
1484 = 1 + 2 + 4 + 7 + 14 + 53 + 106 + 212 + 371 + 742 - 28
1488 = 1 + 2 + 3 + 4 + 6 + 8 + 12 + 16 + 24 + 31 + 48 + 62 + 93 + 124 + 186 + 248 + 372 + 744 - 496
1504 = 1 + 2 + 4 + 16 + 32 + 47 + 94 + 188 + 376 + 752 - 8
1506 = 1 + 2 + 3 + 251 + 502 + 753 - 6
1542 = 1 + 2 + 3 + 257 + 514 + 771 - 6
1578 = 1 + 2 + 3 + 263 + 526 + 789 - 6
1614 = 1 + 2 + 3 + 269 + 538 + 807 - 6
1626 = 1 + 2 + 3 + 271 + 542 + 813 - 6
1638 = 1 + 2 + 3 + 6 + 7 + 9 + 13 + 14 + 18 + 21 + 26 + 39 + 42 + 63 + 78 + 91 + 117 + 126 + 182 + 234 + 273 + 819 - 546
1652 = 1 + 2 + 4 + 7 + 14 + 59 + 118 + 236 + 413 + 826 - 28
1662 = 1 + 2 + 3 + 277 + 554 + 831 - 6
1686 = 1 + 2 + 3 + 281 + 562 + 843 - 6
1698 = 1 + 2 + 3 + 283 + 566 + 849 - 6
1708 = 1 + 2 + 4 + 7 + 14 + 61 + 122 + 244 + 427 + 854 - 28
1758 = 1 + 2 + 3 + 293 + 586 + 879 - 6
1842 = 1 + 2 + 3 + 307 + 614 + 921 - 6
1866 = 1 + 2 + 3 + 311 + 622 + 933 - 6
1876 = 1 + 2 + 4 + 7 + 14 + 67 + 134 + 268 + 469 + 938 - 28
1878 = 1 + 2 + 3 + 313 + 626 + 939 - 6
1888 = 1 + 4 + 8 + 16 + 32 + 59 + 118 + 236 + 472 + 944 - 2
1902 = 1 + 2 + 3 + 317 + 634 + 951 - 6
1952 = 2 + 4 + 8 + 16 + 32 + 61 + 122 + 244 + 488 + 976 - 1
1986 = 1 + 2 + 3 + 331 + 662 + 993 - 6
1988 = 1 + 2 + 4 + 7 + 14 + 71 + 142 + 284 + 497 + 994 - 28
2002 = 1 + 2 + 7 + 11 + 13 + 22 + 26 + 77 + 91 + 143 + 154 + 182 + 286 + 1001 - 14
2022 = 1 + 2 + 3 + 337 + 674 + 1011 - 6
2044 = 1 + 2 + 4 + 7 + 14 + 73 + 146 + 292 + 511 + 1022 - 28
2082 = 1 + 2 + 3 + 347 + 694 + 1041 - 6
2094 = 1 + 2 + 3 + 349 + 698 + 1047 - 6
2118 = 1 + 2 + 3 + 353 + 706 + 1059 - 6
2154 = 1 + 2 + 3 + 359 + 718 + 1077 - 6
2202 = 1 + 2 + 3 + 367 + 734 + 1101 - 6
2212 = 1 + 2 + 4 + 7 + 14 + 79 + 158 + 316 + 553 + 1106 - 28
2238 = 1 + 2 + 3 + 373 + 746 + 1119 - 6
2274 = 1 + 2 + 3 + 379 + 758 + 1137 - 6
2298 = 1 + 2 + 3 + 383 + 766 + 1149 - 6
2324 = 1 + 2 + 4 + 7 + 14 + 83 + 166 + 332 + 581 + 1162 - 28
2334 = 1 + 2 + 3 + 389 + 778 + 1167 - 6
2382 = 1 + 2 + 3 + 397 + 794 + 1191 - 6
2406 = 1 + 2 + 3 + 401 + 802 + 1203 - 6
2454 = 1 + 2 + 3 + 409 + 818 + 1227 - 6
2480 = 1 + 2 + 4 + 5 + 8 + 10 + 16 + 20 + 31 + 40 + 62 + 80 + 124 + 155 + 248 + 310 + 620 + 1240 - 496
2492 = 1 + 2 + 4 + 7 + 14 + 89 + 178 + 356 + 623 + 1246 - 28
2514 = 1 + 2 + 3 + 419 + 838 + 1257 - 6
2526 = 1 + 2 + 3 + 421 + 842 + 1263 - 6
2586 = 1 + 2 + 3 + 431 + 862 + 1293 - 6
2598 = 1 + 2 + 3 + 433 + 866 + 1299 - 6
2634 = 1 + 2 + 3 + 439 + 878 + 1317 - 6
2658 = 1 + 2 + 3 + 443 + 886 + 1329 - 6
2694 = 1 + 2 + 3 + 449 + 898 + 1347 - 6
2716 = 1 + 2 + 4 + 7 + 14 + 97 + 194 + 388 + 679 + 1358 - 28
2742 = 1 + 2 + 3 + 457 + 914 + 1371 - 6
2766 = 1 + 2 + 3 + 461 + 922 + 1383 - 6
2778 = 1 + 2 + 3 + 463 + 926 + 1389 - 6
2802 = 1 + 2 + 3 + 467 + 934 + 1401 - 6
2828 = 1 + 2 + 4 + 7 + 14 + 101 + 202 + 404 + 707 + 1414 - 28
2874 = 1 + 2 + 3 + 479 + 958 + 1437 - 6
2884 = 1 + 2 + 4 + 7 + 14 + 103 + 206 + 412 + 721 + 1442 - 28
2922 = 1 + 2 + 3 + 487 + 974 + 1461 - 6
2946 = 1 + 2 + 3 + 491 + 982 + 1473 - 6
2994 = 1 + 2 + 3 + 499 + 998 + 1497 - 6
2996 = 1 + 2 + 4 + 7 + 14 + 107 + 214 + 428 + 749 + 1498 - 28
3018 = 1 + 2 + 3 + 503 + 1006 + 1509 - 6
3052 = 1 + 2 + 4 + 7 + 14 + 109 + 218 + 436 + 763 + 1526 - 28
3054 = 1 + 2 + 3 + 509 + 1018 + 1527 - 6
3126 = 1 + 2 + 3 + 521 + 1042 + 1563 - 6
3138 = 1 + 2 + 3 + 523 + 1046 + 1569 - 6
3164 = 1 + 2 + 4 + 7 + 14 + 113 + 226 + 452 + 791 + 1582 - 28
3230 = 1 + 2 + 5 + 17 + 19 + 34 + 38 + 85 + 95 + 170 + 190 + 323 + 646 + 1615 - 10
3246 = 1 + 2 + 3 + 541 + 1082 + 1623 - 6
3250 = 1 + 2 + 5 + 10 + 13 + 25 + 50 + 65 + 125 + 130 + 250 + 325 + 650 + 1625 - 26
3282 = 1 + 2 + 3 + 547 + 1094 + 1641 - 6
3342 = 1 + 2 + 3 + 557 + 1114 + 1671 - 6
3378 = 1 + 2 + 3 + 563 + 1126 + 1689 - 6
3414 = 1 + 2 + 3 + 569 + 1138 + 1707 - 6
3426 = 1 + 2 + 3 + 571 + 1142 + 1713 - 6
3462 = 1 + 2 + 3 + 577 + 1154 + 1731 - 6
3472 = 1 + 2 + 4 + 7 + 8 + 14 + 16 + 28 + 31 + 56 + 62 + 112 + 124 + 217 + 248 + 434 + 868 + 1736 - 496
3522 = 1 + 2 + 3 + 587 + 1174 + 1761 - 6
3556 = 1 + 2 + 4 + 7 + 14 + 127 + 254 + 508 + 889 + 1778 - 28
3558 = 1 + 2 + 3 + 593 + 1186 + 1779 - 6
3594 = 1 + 2 + 3 + 599 + 1198 + 1797 - 6
3606 = 1 + 2 + 3 + 601 + 1202 + 1803 - 6
3642 = 1 + 2 + 3 + 607 + 1214 + 1821 - 6
3668 = 1 + 2 + 4 + 7 + 14 + 131 + 262 + 524 + 917 + 1834 - 28
3678 = 1 + 2 + 3 + 613 + 1226 + 1839 - 6
3702 = 1 + 2 + 3 + 617 + 1234 + 1851 - 6
3714 = 1 + 2 + 3 + 619 + 1238 + 1857 - 6
3724 = 1 + 2 + 4 + 7 + 14 + 19 + 28 + 38 + 49 + 76 + 98 + 133 + 196 + 532 + 931 + 1862 - 266
3770 = 1 + 2 + 5 + 13 + 26 + 29 + 58 + 65 + 130 + 145 + 290 + 377 + 754 + 1885 - 10
3786 = 1 + 2 + 3 + 631 + 1262 + 1893 - 6
3836 = 1 + 2 + 4 + 7 + 14 + 137 + 274 + 548 + 959 + 1918 - 28
3846 = 1 + 2 + 3 + 641 + 1282 + 1923 - 6
3858 = 1 + 2 + 3 + 643 + 1286 + 1929 - 6
3882 = 1 + 2 + 3 + 647 + 1294 + 1941 - 6
3892 = 1 + 2 + 4 + 7 + 14 + 139 + 278 + 556 + 973 + 1946 - 28
3918 = 1 + 2 + 3 + 653 + 1306 + 1959 - 6
3954 = 1 + 2 + 3 + 659 + 1318 + 1977 - 6
3966 = 1 + 2 + 3 + 661 + 1322 + 1983 - 6
4030 = 1 + 5 + 10 + 13 + 26 + 31 + 62 + 65 + 130 + 155 + 310 + 403 + 806 + 2015 - 2
4038 = 1 + 2 + 3 + 673 + 1346 + 2019 - 6
4062 = 1 + 2 + 3 + 677 + 1354 + 2031 - 6
4095 = 1 + 3 + 5 + 7 + 9 + 13 + 15 + 21 + 35 + 39 + 45 + 63 + 65 + 91 + 105 + 117 + 195 + 315 + 455 + 585 + 819 + 1365 - 273
4098 = 1 + 2 + 3 + 683 + 1366 + 2049 - 6
4146 = 1 + 2 + 3 + 691 + 1382 + 2073 - 6
4172 = 1 + 2 + 4 + 7 + 14 + 149 + 298 + 596 + 1043 + 2086 - 28
4206 = 1 + 2 + 3 + 701 + 1402 + 2103 - 6
4228 = 1 + 2 + 4 + 7 + 14 + 151 + 302 + 604 + 1057 + 2114 - 28
4254 = 1 + 2 + 3 + 709 + 1418 + 2127 - 6
4314 = 1 + 2 + 3 + 719 + 1438 + 2157 - 6
4362 = 1 + 2 + 3 + 727 + 1454 + 2181 - 6
4396 = 1 + 2 + 4 + 7 + 14 + 157 + 314 + 628 + 1099 + 2198 - 28
4398 = 1 + 2 + 3 + 733 + 1466 + 2199 - 6
4434 = 1 + 2 + 3 + 739 + 1478 + 2217 - 6
4458 = 1 + 2 + 3 + 743 + 1486 + 2229 - 6
4506 = 1 + 2 + 3 + 751 + 1502 + 2253 - 6
4542 = 1 + 2 + 3 + 757 + 1514 + 2271 - 6
4564 = 1 + 2 + 4 + 7 + 14 + 163 + 326 + 652 + 1141 + 2282 - 28
4566 = 1 + 2 + 3 + 761 + 1522 + 2283 - 6
4614 = 1 + 2 + 3 + 769 + 1538 + 2307 - 6
4638 = 1 + 2 + 3 + 773 + 1546 + 2319 - 6
4676 = 1 + 2 + 4 + 7 + 14 + 167 + 334 + 668 + 1169 + 2338 - 28
4722 = 1 + 2 + 3 + 787 + 1574 + 2361 - 6
4730 = 1 + 2 + 5 + 10 + 11 + 43 + 55 + 86 + 110 + 215 + 430 + 473 + 946 + 2365 - 22
4782 = 1 + 2 + 3 + 797 + 1594 + 2391 - 6
4844 = 1 + 2 + 4 + 7 + 14 + 173 + 346 + 692 + 1211 + 2422 - 28
4854 = 1 + 2 + 3 + 809 + 1618 + 2427 - 6
4866 = 1 + 2 + 3 + 811 + 1622 + 2433 - 6
4926 = 1 + 2 + 3 + 821 + 1642 + 2463 - 6
4938 = 1 + 2 + 3 + 823 + 1646 + 2469 - 6
4962 = 1 + 2 + 3 + 827 + 1654 + 2481 - 6
4974 = 1 + 2 + 3 + 829 + 1658 + 2487 - 6
收到的鲜花
  • ZL张琳2016-04-26 15:20 送鲜花  3朵   附言:好文章

授人于鱼,不如授人于渔
早已停用QQ了
2016-04-25 17:35
ZL张琳
Rank: 1
来 自:浙江省
等 级:新手上路
帖 子:5
专家分:0
注 册:2016-4-22
收藏
得分:0 
大神,真是不好意思,可能是我在复制的时候不小心漏了,您的编程确实一点错误都没有。
我想是我没有说清楚我具体想要的结果,对不起。
我想的其实是在点击运行时,程序能够在一个范围内找出所有佩服数。
比如我在Text1中输入10,在Text2中输入60,然后点击运行,就能把这一范围内的佩服数全部显示在Picture1中。
我上张图,您看一下
图片附件: 游客没有浏览图片的权限,请 登录注册

这是书上显示的运行结果
图片附件: 游客没有浏览图片的权限,请 登录注册

VB一定过!!!
2016-04-26 15:19
快速回复:求助!找出给定范围内的佩服数编程
数据加载中...
 
   



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

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