編程題庫采購
發布時間: 2024-05-25 06:25:54
A. PASCAL璇璦緙栫▼錛氫竴涓鐐婁簨鍛樹笂琛楅噰璐錛岀敤500鍏冧拱浜90鍙楦★紝鍏朵腑姣嶉浮涓鍙15鍏冿紝鍏
Rem PASCAL璇璦緙栫▼錛氫竴涓鐐婁簨鍛樹笂琛楅噰璐錛岀敤500鍏冧拱浜90鍙楦★紝鍏朵腑姣嶉浮涓鍙15鍏冿紝鍏
Rem x=15 y=20
Rem 鍥犱負鎴戜笉浼歅ASCAL鏁呯敤vb緙栫殑,鎴戝彧鏄璇存槑榪欑嶆柟娉
Private Sub Command1_Click()
x = 15 '榪欎釜鏄姣嶉浮鐨勫崟浠
y = 5 '榪欎釜鏄鍏楦$殑鍗曚環 鎴戣$畻榪囦簡榪欏彧鏈変簲鎵嶇﹀悎
For i = 1 To 90 '90涓哄崟縐嶉浮鐨勬渶澶у
For j = 1 To 90 '90涓哄崟縐嶉浮鐨勬渶澶у
If i * x + j * y = 500 And i + j = 90 Then
Rem 濡傛灉i涔榵鍔爅涔榶絳変簬500鍜宨鍔爅絳90
ss = ss & "緇撴灉:" & vbCrLf '鍔犲叆緇撴灉
ss = ss & " 鍏楦" & i & "鍙" & " -> 鍏辯敤" & i * x & "鏃" & vbCrLf & " 姣嶉浮" & j & "鍙" & " -> 鍏辯敤" & j * y & "鏃" & vbCrLf
Exit For
End If
Next
Next
If ss <> "" Then MsgBox ss
End Sub
熱點內容