谁能帮我看看这个vb程序怎么写?谢谢!
我想在方程y1=3+x+sin(x)+cos(x)的等号右边中,随机的选取一部分M1(可能只是3或只是x,也可能是3+x,可能是x+sin(x)+cos(x));然后在方程y2=5x+log(x)+tan(x)+cot(x) 的等号右边中随机的选择一部分M2;然后将M1和M2交换,组成新的方程y1和y2,然后再进行方程的计算!请问这个程序怎么写呢?非常感谢! --------------------编程问答-------------------- 找苦力的 --------------------编程问答-------------------- 这么简单的程序都不会写,lz侮辱了程序员这个群体。 --------------------编程问答-------------------- 如果这个程序真像2楼说的那么简单的话,人家怎么回写成一本书,当然没你想象的那么简单了 !不要总是眼高手低,自己写写才行! --------------------编程问答-------------------- 如果这个程序真像2楼说的那么简单的话,人家怎么回写成一本书,当然没你想象的那么简单了 !不要总是眼高手低,自己写写才行! --------------------编程问答-------------------- 不要总是眼高手低,自己写写才行! --------------------编程问答-------------------- --------------------编程问答-------------------- 用VB还是C语言? --------------------编程问答--------------------什么书?我来学习下。 --------------------编程问答-------------------- 'y1 = 3 + x + Sin(x) + Cos(x)
'y2 = 5x + log(x) + tan(x) + cot(x)
Dim n1 As Integer, n2 As Integer 'y1 和 y2 的两个随机数
Dim y1SF As String, y1SL As String, y2SF As String, y2SL As String 'y1 和 y2 拆开后各自的两段公式串。
Dim y1NF, y1NL, y2NF, y2NL 'y1 和 y2 拆开后各自的两段公式的值。
Dim y1, y2, y1S, y2S
Randomize: n1 = Int(4 * Rnd) + 1: Randomize: n2 = Int(4 * Rnd) + 1
If n1 = 1 Then
y1SF = "3": y1SL = " + x + Sin(x) + Cos(x)"
y1NF = 3: y1NF = x + Sin(x) + Cos(x)
ElseIf n1 = 2 Then
y1SF = "3 + x": y1SL = " + Sin(x) + Cos(x)"
y1NF = 3 + x: y1NF = Sin(x) + Cos(x)
ElseIf n1 = 3 Then
y1SF = "3 + x + Sin(x)": y1SL = " + Cos(x)"
y1NF = 3 + x + Sin(x): y1NF = Cos(x)
Else
y1SF = "3 + x + Sin(x) + Cos(x)": y1SL = ""
y1NF = 3 + x + Sin(x) + Cos(x): y1NF = 0
End If
If n2 = 1 Then
y2SF = "5x": y2SL = " + log(x) + tan(x) + cot(x)"
y2NF = 5 * x: y2NF = Log(x) + Tan(x) + Cot(x)
ElseIf n2 = 2 Then
y2SF = "5x + log(x)": y2SL = " + tan(x) + cot(x)"
y2NF = 5 * x + Log(x): y2NF = Tan(x) + Cot(x)
ElseIf n2 = 3 Then
y2SF = "5x + log(x) +tan(x)": y2SL = " + cot(x)"
y2NF = 5 * x + Log(x) + Tan(x): y2NF = Cos(x)
Else
y2SF = "3 + x + Sin(x) + Cos(x)": y2SL = ""
y2NF = 5 * x + Log(x) + Tan(x) + Cot(x): y2NF = 0
End If
y1 = y1NF + y2NL: y2 = y1NL + y2NF
y1S = y1SF & y2SL: y2S = y2SF & y1SL
Debug.Print "y1 = " & y1S & " = " & y1, "y2 = " & y2S & " = " & y2
--------------------编程问答--------------------
挖苦,呵呵 --------------------编程问答-------------------- 暂时还看不懂,只能在旁边游。 --------------------编程问答-------------------- y1NF = 3: y1NF = x + Sin(x) + Cos(x)
这句写错了。应该是 y1NF = 3: y1NL = x + Sin(x) + Cos(x)
其他类同,懒得改了。
--------------------编程问答-------------------- 将if elseif改成select case会更清晰 --------------------编程问答--------------------
《遗传规划》Genetic programming --------------------编程问答--------------------
配对基因序列的算法多了去了,这本书就介绍这一个算法啊。。。 --------------------编程问答-------------------- 真像你说的这种逻辑,还真是简单的不得了,这都搞不定,真有点 --------------------编程问答--------------------
搞生物研究的
补充:VB , 基础类