VB程式設計,輸入平面上任一點的座標 x,y ,判斷並顯示該點位

2021-08-18 00:13:29 字數 1308 閱讀 7417

1樓:匿名使用者

function which(byval p as pointf) as string

dim tp as string = math.sign(p.x) & "," & math.sign(p.y)

select case tp

case "0,0"

return "原點"

case "0,1", "0,-1"

return "y軸"

case "1,0", "-1,0"

return "x軸"

case "1,1"

return "第一象限"

case "-1,1"

return "第二象限"

case "-1,-1"

return "第三象限"

case "1,-1"

return "第四象限"

end select

end function

2樓:匿名使用者

dim inx as long ,iny as longinx = val(inputbox("請輸入x軸數值"))iny = val(inputbox("請輸入y軸數值"))if inx>0 then

if iny>0 then 'x,y >0 第一象限msgbox "座標(" & inx & "," & iny & ") 在第一象限"

elseif iny<0 then ' x> 0 >y第四象限msgbox "座標(" & inx & "," & iny & ") 在第四象限"

end if

elseif inx<0 then

if iny>0 then 'y>0>x 第二象限msgbox "座標(" & inx & "," & iny & ") 在第二象限"

elseif iny<0 then ' x0 thenmsgbox "座標在x軸上"

end if

end if

if iny=0 then

if inx<>0 then

msgbox "座標在y軸上"

end if

end if

'懶得開vb了

(用c++編寫程式)輸入平面直角座標系中一點的座標(x,y),判斷改點是在那個象限中或那一條座標軸上

3樓:匿名使用者

include "math.h"

class point

};class line

float getdistance(point p)};void main()

VB程式設計

第一種比較容易看的 private sub command1 click dim req as vbmsgboxresult req msgbox are you continue to?vbabortretryignore vbquestion,功能測試 print req end sub 第二種...

vb程式設計問題

private sub command1 click dim i,j as integer,s as double,n as double for i 1 to 100 n 1 for j 1 to i n n j next j s s n next i print 1 2 100 send sub...

vb程式設計問題

此方法是用隨機數產生20個不重複的數,顯示20個數,再挑出奇數,再排列,再顯示。數字之間用空格隔開。private sub command1 click text1 text2 dim a 1 to 20 b 1 to 20 as integer dim i,i1,i2,j,j1,j2,j3,j4,...