15 lines
318 B
Plaintext
15 lines
318 B
Plaintext
v1$ = "1, 3, -5"
|
|
v2$ = "4, -2, -1"
|
|
|
|
print "DotProduct of ";v1$;" and "; v2$;" is ";dotProduct(v1$,v2$)
|
|
end
|
|
|
|
function dotProduct(a$, b$)
|
|
while word$(a$,i + 1,",") <> ""
|
|
i = i + 1
|
|
v1$=word$(a$,i,",")
|
|
v2$=word$(b$,i,",")
|
|
dotProduct = dotProduct + val(v1$) * val(v2$)
|
|
wend
|
|
end function
|