VB编程,输入平面上任一点的坐标(x,y),判断并显示该点位于哪个象限的信息

 我来答
WWEERR
2011-03-27 · TA获得超过841个赞
知道小有建树答主
回答量:536
采纳率:0%
帮助的人:523万
展开全部
Dim InX as long ,InY as long

InX = 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 ' X<Y<0 第三象限
msgbox "坐标(" & inx & "," & Iny & ") 在第三象限"
end if
elseif InX=0 then
if InY=0 then
msgbox "坐标在原点"
elseif InY <>0 then
msgbox "坐标在X轴上"
end if
end if
if InY=0 then
if InX<>0 then
msgbox "坐标在Y轴上"
end if
end if

'懒得开VB了
zhenghanxi
2011-03-27 · TA获得超过422个赞
知道小有建树答主
回答量:268
采纳率:0%
帮助的人:253万
展开全部
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
本回答被提问者和网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式