الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

اريد ان افهم هذا الكود

بدأه hicham716 في 15 يوليو 2008 · 7 رد · 1,073 مشاهدة · في لغة Ms Visual Basic 6 وما قبلها من إصدارات
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع
For a = 1 To 16
Print a
For b = 1 To 16
If b = a Then GoTo 10
For c = 1 To 16
If c = a Then GoTo 20
If c = b Then GoTo 20
For d = 1 To 16
If d = a Then GoTo 30
If d = b Then GoTo 30
If d = c Then GoTo 30
aa = a - b
aa1 = aa * c
aa2 = aa1 * d
If aa2 <> -60 Then GoTo 30
For e = 1 To 16
If e = a Then GoTo 40
If e = b Then GoTo 40
If e = c Then GoTo 40
If e = d Then GoTo 40
For f = 1 To 16
If f = a Then GoTo 50
If f = b Then GoTo 50
If f = c Then GoTo 50
If f = d Then GoTo 50
If f = e Then GoTo 50
For g = 1 To 16
If g = a Then GoTo 60
If g = b Then GoTo 60
If g = c Then GoTo 60
If g = d Then GoTo 60
If g = e Then GoTo 60
If g = f Then GoTo 60
For h = 1 To 16
If h = a Then GoTo 70
If h = b Then GoTo 70
If h = c Then GoTo 70
If h = d Then GoTo 70
If h = e Then GoTo 70
If h = f Then GoTo 70
If h = g Then GoTo 70
aa3 = e + f + g - h
If aa3 <> 29 Then GoTo 70
For i = 1 To 16
If i = a Then GoTo 80
If i = b Then GoTo 80
If i = c Then GoTo 80
If i = d Then GoTo 80
If i = e Then GoTo 80
If i = f Then GoTo 80
If i = g Then GoTo 80
If i = h Then GoTo 80
For j = 1 To 16
If j = a Then GoTo 90
If j = b Then GoTo 90
If j = c Then GoTo 90
If j = d Then GoTo 90
If j = e Then GoTo 90
If j = f Then GoTo 90
If j = g Then GoTo 90
If j = h Then GoTo 90
If j = i Then GoTo 90
For k = 1 To 16
If k = a Then GoTo 91
If k = b Then GoTo 91
If k = c Then GoTo 91
If k = d Then GoTo 91
If k = e Then GoTo 91
If k = f Then GoTo 91
If k = g Then GoTo 91
If k = h Then GoTo 91
If k = i Then GoTo 91
If k = j Then GoTo 91
For l = 1 To 16
If l = a Then GoTo 92
If l = b Then GoTo 92
If l = c Then GoTo 92
If l = d Then GoTo 92
If l = e Then GoTo 92
If l = f Then GoTo 92
If l = g Then GoTo 92
If l = h Then GoTo 92
If l = i Then GoTo 92
If l = j Then GoTo 92
If l = k Then GoTo 92
aa4 = i - j - k - l
If aa4 <> -14 Then GoTo 92
For m = 1 To 16
If m = a Then GoTo 93
If m = b Then GoTo 93
If m = c Then GoTo 93
If m = d Then GoTo 93
If m = e Then GoTo 93
If m = f Then GoTo 93
If m = g Then GoTo 93
If m = h Then GoTo 93
If m = i Then GoTo 93
If m = j Then GoTo 93
If m = k Then GoTo 93
If m = l Then GoTo 93
aa5 = a * e + i + m
If aa5 <> 28 Then GoTo 93
For n = 1 To 16
If n = a Then GoTo 94
If n = b Then GoTo 94
If n = c Then GoTo 94
If n = d Then GoTo 94
If n = e Then GoTo 94
If n = f Then GoTo 94
If n = g Then GoTo 94
If n = h Then GoTo 94
If n = i Then GoTo 94
If n = j Then GoTo 94
If n = k Then GoTo 94
If n = l Then GoTo 94
If n = m Then GoTo 94
aa6 = b + f + j - n
If aa6 <> 1 Then GoTo 94
For o = 1 To 16
If o = a Then GoTo 95
If o = b Then GoTo 95
If o = c Then GoTo 95
If o = d Then GoTo 95
If o = e Then GoTo 95
If o = f Then GoTo 95
If o = g Then GoTo 95
If o = h Then GoTo 95
If o = i Then GoTo 95
If o = j Then GoTo 95
If o = k Then GoTo 95
If o = l Then GoTo 95
If o = m Then GoTo 95
If o = n Then GoTo 95
aa7 = c * g - k + o
If aa7 <> 57 Then GoTo 95
For p = 1 To 16
If p = a Then GoTo 96
If p = b Then GoTo 96
If p = c Then GoTo 96
If p = d Then GoTo 96
If p = e Then GoTo 96
If p = f Then GoTo 96
If p = g Then GoTo 96
If p = h Then GoTo 96
If p = i Then GoTo 96
If p = j Then GoTo 96
If p = k Then GoTo 96
If p = l Then GoTo 96
If p = m Then GoTo 96
If p = n Then GoTo 96
If p = o Then GoTo 96
aa8 = d / h * l - p
If aa8 <> 27 Then GoTo 96
aa9 = m * n - o - p
If aa9 <> 32 Then GoTo 96
Print a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p
96 Next p
95 Next o
94 Next n
93 Next m
92 Next l
91 Next k
90 Next j
80 Next i
70 Next h
60 Next g
50 Next f
40 Next e
30 Next d
20 Next c
10 Next b
1 Next a

______________________________________________

" حَافِظُوا عَلَى الصَّلَوَاتِ وَالصَّلاةِ الْوُسْطَى وَقُومُوا لِلَّهِ قَانِتِينَ "

______________________________________________

تحرير بواسطة 'بنهاشم منصوري'

#2

ماذا تعني

If p = o Then GoTo 96

96 Next p

تم تعديل هذه المشاركة بواسطة hicham716 في 16 يوليو 2008 في 12:37

______________________________________________

" حَافِظُوا عَلَى الصَّلَوَاتِ وَالصَّلاةِ الْوُسْطَى وَقُومُوا لِلَّهِ قَانِتِينَ "

______________________________________________

تحرير بواسطة 'بنهاشم منصوري'

#3

على حسب ما اعتقد ان .....

  1.  
  2. dim p,o as Any datatype
  3. if p = o goto 96
  4.  

فى حالة ان المتغير p يساوى المتغير o اذهب للسطر 96

#4

صعب تفهمه وهو بالشكل ده .

إليك الكود بعد التنسيق :

  1.  
  2. For a = 1 To 16
  3. Print a
  4.  
  5. For b = 1 To 16
  6. If b = a Then GoTo 10
  7.  
  8. For c = 1 To 16
  9. If c = a Then GoTo 20
  10. If c = b Then GoTo 20
  11.  
  12. For d = 1 To 16
  13. If d = a Then GoTo 30
  14. If d = b Then GoTo 30
  15. If d = c Then GoTo 30
  16.  
  17. aa = a - b
  18. aa1 = aa * c
  19. aa2 = aa1 * d
  20.  
  21. If aa2 <> -60 Then GoTo 30
  22.  
  23. For e = 1 To 16
  24. If e = a Then GoTo 40
  25. If e = b Then GoTo 40
  26. If e = c Then GoTo 40
  27. If e = d Then GoTo 40
  28.  
  29. For f = 1 To 16
  30. If f = a Then GoTo 50
  31. If f = b Then GoTo 50
  32. If f = c Then GoTo 50
  33. If f = d Then GoTo 50
  34. If f = e Then GoTo 50
  35.  
  36. For g = 1 To 16
  37. If g = a Then GoTo 60
  38. If g = b Then GoTo 60
  39. If g = c Then GoTo 60
  40. If g = d Then GoTo 60
  41. If g = e Then GoTo 60
  42. If g = f Then GoTo 60
  43.  
  44. For h = 1 To 16
  45. If h = a Then GoTo 70
  46. If h = b Then GoTo 70
  47. If h = c Then GoTo 70
  48. If h = d Then GoTo 70
  49. If h = e Then GoTo 70
  50. If h = f Then GoTo 70
  51. If h = g Then GoTo 70
  52.  
  53. aa3 = e + f + g - h
  54.  
  55. If aa3 <> 29 Then GoTo 70
  56.  
  57. For i = 1 To 16
  58. If i = a Then GoTo 80
  59. If i = b Then GoTo 80
  60. If i = c Then GoTo 80
  61. If i = d Then GoTo 80
  62. If i = e Then GoTo 80
  63. If i = f Then GoTo 80
  64. If i = g Then GoTo 80
  65. If i = h Then GoTo 80
  66.  
  67. For j = 1 To 16
  68. If j = a Then GoTo 90
  69. If j = b Then GoTo 90
  70. If j = c Then GoTo 90
  71. If j = d Then GoTo 90
  72. If j = e Then GoTo 90
  73. If j = f Then GoTo 90
  74. If j = g Then GoTo 90
  75. If j = h Then GoTo 90
  76. If j = i Then GoTo 90
  77.  
  78. For k = 1 To 16
  79. If k = a Then GoTo 91
  80. If k = b Then GoTo 91
  81. If k = c Then GoTo 91
  82. If k = d Then GoTo 91
  83. If k = e Then GoTo 91
  84. If k = f Then GoTo 91
  85. If k = g Then GoTo 91
  86. If k = h Then GoTo 91
  87. If k = i Then GoTo 91
  88. If k = j Then GoTo 91
  89.  
  90. For l = 1 To 16
  91. If l = a Then GoTo 92
  92. If l = b Then GoTo 92
  93. If l = c Then GoTo 92
  94. If l = d Then GoTo 92
  95. If l = e Then GoTo 92
  96. If l = f Then GoTo 92
  97. If l = g Then GoTo 92
  98. If l = h Then GoTo 92
  99. If l = i Then GoTo 92
  100. If l = j Then GoTo 92
  101. If l = k Then GoTo 92
  102.  
  103. aa4 = i - j - k - l
  104.  
  105. If aa4 <> -14 Then GoTo 92
  106.  
  107. For m = 1 To 16
  108. If m = a Then GoTo 93
  109. If m = b Then GoTo 93
  110. If m = c Then GoTo 93
  111. If m = d Then GoTo 93
  112. If m = e Then GoTo 93
  113. If m = f Then GoTo 93
  114. If m = g Then GoTo 93
  115. If m = h Then GoTo 93
  116. If m = i Then GoTo 93
  117. If m = j Then GoTo 93
  118. If m = k Then GoTo 93
  119. If m = l Then GoTo 93
  120.  
  121. aa5 = a * e + i + m
  122.  
  123. If aa5 <> 28 Then GoTo 93
  124.  
  125. For n = 1 To 16
  126. If n = a Then GoTo 94
  127. If n = b Then GoTo 94
  128. If n = c Then GoTo 94
  129. If n = d Then GoTo 94
  130. If n = e Then GoTo 94
  131. If n = f Then GoTo 94
  132. If n = g Then GoTo 94
  133. If n = h Then GoTo 94
  134. If n = i Then GoTo 94
  135. If n = j Then GoTo 94
  136. If n = k Then GoTo 94
  137. If n = l Then GoTo 94
  138. If n = m Then GoTo 94
  139.  
  140. aa6 = b + f + j - n
  141.  
  142. If aa6 <> 1 Then GoTo 94
  143.  
  144. For o = 1 To 16
  145. If o = a Then GoTo 95
  146. If o = b Then GoTo 95
  147. If o = c Then GoTo 95
  148. If o = d Then GoTo 95
  149. If o = e Then GoTo 95
  150. If o = f Then GoTo 95
  151. If o = g Then GoTo 95
  152. If o = h Then GoTo 95
  153. If o = i Then GoTo 95
  154. If o = j Then GoTo 95
  155. If o = k Then GoTo 95
  156. If o = l Then GoTo 95
  157. If o = m Then GoTo 95
  158. If o = n Then GoTo 95
  159.  
  160. aa7 = c * g - k + o
  161.  
  162. If aa7 <> 57 Then GoTo 95
  163.  
  164. For p = 1 To 16
  165. If p = a Then GoTo 96
  166. If p = b Then GoTo 96
  167. If p = c Then GoTo 96
  168. If p = d Then GoTo 96
  169. If p = e Then GoTo 96
  170. If p = f Then GoTo 96
  171. If p = g Then GoTo 96
  172. If p = h Then GoTo 96
  173. If p = i Then GoTo 96
  174. If p = j Then GoTo 96
  175. If p = k Then GoTo 96
  176. If p = l Then GoTo 96
  177. If p = m Then GoTo 96
  178. If p = n Then GoTo 96
  179. If p = o Then GoTo 96
  180.  
  181. aa8 = d / h * l - p
  182.  
  183. If aa8 <> 27 Then GoTo 96
  184. aa9 = m * n - o - p
  185.  
  186. If aa9 <> 32 Then GoTo 96
  187. Print a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p
  188.  
  189.  
  190. 96 Next p
  191. 95 Next o
  192. 94 Next n
  193. 93 Next m
  194. 92 Next l
  195. 91 Next k
  196. 90 Next j
  197. 80 Next i
  198. 70 Next h
  199. 60 Next g
  200. 50 Next f
  201. 40 Next e
  202. 30 Next d
  203. 20 Next c
  204. 10 Next b
  205. 1 Next a
  206.  

والكود بعد اختصاره :

  1.  
  2. For a = 1 To 16
  3. Print a
  4.  
  5. For b = 1 To 16
  6. If b = a Then Next a
  7.  
  8. For c = 1 To 16
  9. If c = a Or c = b Then Next c
  10.  
  11. For d = 1 To 16
  12. If d = a Or d = b Or d = c Then Next d
  13.  
  14. aa = a - b
  15. aa1 = aa * c
  16. aa2 = aa1 * d
  17.  
  18. If aa2 <> -60 Then GoTo 30
  19.  
  20. For e = 1 To 16
  21. If e = a Or e = b Or e = c Or e = d Then Next e
  22.  
  23. For f = 1 To 16
  24. If f = a Or f = b Or f = c Or f = d Or f = e Then Next f
  25.  
  26. For g = 1 To 16
  27. If g = a Or g = b Or g = c Or g = d Or g = e Or g = f Then Next g
  28.  
  29. For h = 1 To 16
  30. If h = a Or h = b Or h = c Or h = d Or h = e Or h = f Or h = g Then Next h
  31.  
  32. aa3 = e + f + g - h
  33.  
  34. If aa3 <> 29 Then Next h
  35.  
  36. For i = 1 To 16
  37. If i = a Or i = b Or i = c Or i = d Or i = e Or i = f Or i = g Or i = h Then Next i
  38.  
  39. For j = 1 To 16
  40. If j = a Or j = b Or j = c Or j = d Or j = e Or j = f Or j = g Or j = h Or j = i Then Next
    j
  41.  
  42. For k = 1 To 16
  43. If k = a Or k = b Or k = c Or k = d Or k = e Or k = f Or k = g Or k = h Or k = i Or k = j T
    hen Next k
  44.  
  45. For l = 1 To 16
  46. If l = a Or l = b Or l = c Or l = d Or l = e Or l = f Or l = g Or l = h Or l = i Or l = j O
    r l = k Then Next l
  47.  
  48. aa4 = i - j - k - l
  49.  
  50. If aa4 <> -14 Then GoTo 92
  51.  
  52. For m = 1 To 16
  53. If m = a Or m = b Or m = c Or m = d Or m = e Or m = f Or m = g Or m = h Or m = i Or m = j O
    r m = k Or m = l Then Next m
  54.  
  55. aa5 = a * e + i + m
  56.  
  57. If aa5 <> 28 Then GoTo 93
  58.  
  59. For n = 1 To 16
  60. If n = a Or n = b Or n = c Or n = d Or n = e Or n = f Or n = g Or n = h Or n = i Or n = j O
    r n = k Or n = l Or n = m Then Next n
  61.  
  62. aa6 = b + f + j - n
  63.  
  64. If aa6 <> 1 Then GoTo 94
  65.  
  66. For o = 1 To 16
  67. If o = a Or o = b Or o = c Or o = d Or o = e Or o = f Or o = g Or o = h Or o = i Or o = j O
    r o = k Or o = l Or o = m Or o = n Then Next o
  68.  
  69. aa7 = c * g - k + o
  70.  
  71. If aa7 <> 57 Then GoTo 95
  72.  
  73. For p = 1 To 16
  74. If p = a Or p = b Or p = c Or p = d Or p = e Or p = f Or p = g Or p = h Or p = i Or p = j O
    r p = k Or p = l Or p = m Or p = n Or p = o Then Next p
  75.  
  76. aa8 = d / h * l - p
  77.  
  78. If aa8 <> 27 Then GoTo 96
  79. aa9 = m * n - o - p
  80.  
  81. If aa9 <> 32 Then GoTo 96
  82.  
  83. Print a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p
  84. End Sub
  85.  

بالنسبة لوظيفة الكود , فهو يدور على عدة متغيرات ومن ثم يقارن قيمة المتغير الذي يدور عليه بقيم بقية المتغيرات , فإن كانت مساوية له فإنه ينتقل إلى الدورة التالية

ويقوم ببعض العمليات على هذه المتغيرات

وفي النهاية يقوم بطباعتها

اقتباس
If A is success in life, then A equals x plus y plus z. Work is x; y is play; and z is keeping your mouth shut

Albert Einstein

مدخل إلى برمجة وتصميم الألعاب : كيف أبدأ ؟

#5

السلام عليكم

جزاك الله خيرا اخي عمر

جزاك الله خيرا اخي علاء

بعض العبارات في الباسيك لم يسبق لي استعمالها و اريد معرفتها مثل

If p = o Then GoTo 96

ما اعرفه انا هو

If p = o Then
الدي تريده
end if

ماذا تعني GoTo 96

وكذالك

96 Next p

ما اعرفه انا هو

Next p

______________________________________________

" حَافِظُوا عَلَى الصَّلَوَاتِ وَالصَّلاةِ الْوُسْطَى وَقُومُوا لِلَّهِ قَانِتِينَ "

______________________________________________

تحرير بواسطة 'بنهاشم منصوري'

#6

up

_________

______________________________________________

" حَافِظُوا عَلَى الصَّلَوَاتِ وَالصَّلاةِ الْوُسْطَى وَقُومُوا لِلَّهِ قَانِتِينَ "

______________________________________________

تحرير بواسطة 'بنهاشم منصوري'

#7
اقتباس
If p = o Then GoTo 96

تعنى هذه العبارة انه فى حالة تحقق الشرط اذهب الى الدليل 96 وقد يكون الدليل رقما او حرفا ويكون هذا الحرف او الرقم موجود فى موضع معين فى بداية سطر فى الكود اليك مثال بسيط للتوضيح

Test1.rar

تم تعديل هذه المشاركة بواسطة عبدالفتاح حسن في 18 يوليو 2008 في 22:28

كن كالنخيل عن الأحقاد مرتفعا .. يرمى بصخر فيرمى أطيب الثمر

#8
عبدالفتاح حسن كتب:
تعنى هذه العبارة انه فى حالة تحقق الشرط اذهب الى الدليل 96 وقد يكون الدليل رقما او حرفا ويكون هذا الحرف او الرقم موجود فى موضع معين فى بداية سطر فى الكود اليك مثال بسيط للتوضيح

جزاك الله خيرا اخي عبد الفتاح

تم تعديل هذه المشاركة بواسطة hicham716 في 21 يوليو 2008 في 16:20

______________________________________________

" حَافِظُوا عَلَى الصَّلَوَاتِ وَالصَّلاةِ الْوُسْطَى وَقُومُوا لِلَّهِ قَانِتِينَ "

______________________________________________

تحرير بواسطة 'بنهاشم منصوري'

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…