Vector: Difference between revisions

1,283 bytes added ,  1 year ago
m (syntax highlighting fixup automation)
Line 931:
[5, 7] / 2 = [2.5, 3.5]
</pre>
? "------------------------------------------------"
'compare with:
'----------------------------------------------------------------------------------------------------------------
dim shared as integer v01(2),v02(2),v03(2),v05(2)
dim shared as single v04(2)
'
sub v01_(x as integer,y as integer,z as integer):v01(0)=x:v01(1)=y:v01(2)=z:end sub
sub v02_(x as integer,y as integer,z as integer):v02(0)=x:v02(1)=y:v02(2)=z:end sub
sub v03_(x as integer,y as integer,z as integer):v03(0)=x:v03(1)=y:v03(2)=z:end sub
sub v04_(x as single,y as single,z as single):v04(0)=x:v04(1)=y:v04(2)=z:end sub
sub p(v() as integer):? "[";v(0);"/";v(1);"/";v(2);"]":end sub
sub ps(v() as single):? "[";v(0);"/";v(1);"/";v(2);"]":end sub
'
v01_(5,7,0):?"v01=";:p(v01())
v02_(2,3,0):?"v02=";:p(v02())
v03_(v01(0)+v02(0),v01(1)+v02(1),v01(2)+v02(2)) :?"v03=v01+v02=";:p(v03())
v03_(v01(0)-v02(0),v01(1)-v02(1),v01(2)-v02(2)) :?"v03=v01-v02=";:p(v03())
v03_(v01(0)*11,v01(1)*11,v01(2)*11) :?"v03=v01*11=" ;:p(v03()) '? integer
v04_(v01(0)/2,v01(1)/2,v01(2)/2) :?"v04=v01/2=" ;:ps(v04()) '? single
? "------------------------------------------------"
do:loop
'----------------------------------------------------------------------------------------------------------------
'
 
=={{header|Go}}==
6

edits