用vb计算生肖 计算机算生肖

生肖属相 2023-10-17 15:46属相相冲www.mhkrcw.com

vb 如何计算生肖

添加一个按钮和一个文本框,文本框用来输入年份。

回楼上:虽然农历纪年和公历纪年有很大差别,但是绝对是一年对应一年。农历年天数少,所以制定闰年制度来防止农历年比公历年慢。

Dimshengxiao(12)AsString

PrivateSubCommand1_Click()

Cls

Printshengxiao(Val(Text1.Text)Mod12)

EndSub

PrivateSubForm_Load()

shengxiao(0)="牛"

shengxiao(1)="鼠"

shengxiao(2)="猪"

shengxiao(3)="狗"

shengxiao(4)="鸡"

shengxiao(5)="猴"

shengxiao(6)="羊"

shengxiao(7)="马"

shengxiao(8)="蛇"

shengxiao(9)="龙"

shengxiao(10)="兔"

shengxiao(11)="虎"

EndSub

VB 判断生肖

Dima(1To12)AsString

PrivateSubCommand1_Click()

n=Combo1.Text

Ifn<=0ThenMsgBox"请输入大于0的数!":ExitSub

Ifn<12Then

n=n+12

EndIf

Ifn>=12Then

r=nMod12

SelectCaser

Case4:sx="鼠"

Case5:sx="牛"

Case6:sx="虎"

Case7:sx="兔"

Case8:sx="龙"

Case9:sx="蛇"

Case10:sx="马"

Case11:sx="羊"

Case0:sx="猴"

Case1:sx="鸡"

Case2:sx="狗"

Case3:sx="猪"

EndSelect

EndIf

Label1.Caption=sx

EndSub

PrivateSubForm_Load()

Label1.Caption=""

Label1.FontSize=30

Label1.ForeColor=vbBlue

EndSub

用VB语言编写输入出生日期算出生肖与星座的程序

&39;新建窗体form1

&39;添加控件DTPicker1,Command1

PrivateSubCommand1_Click()

DimaaAsInteger

DimbbAsInteger

DimAsInteger

Dimdd_xingzuoAsInteger

Dimdd_shengxiaoAsInteger

DimleirongAsString

bb=DTPicker1.Month

aa=DTPicker1.Day

=DTPicker1.Year

dd_xingzuo=(bb*100+aa)

dd_shengxiao=Mod12

Ifdd_xingzuo>112Anddd_xingzuo<221Then

leirong="星座:水瓶座"

EndIf

Ifdd_xingzuo>=221Anddd_xingzuo<=321Then

leirong="星座:双鱼座"

EndIf

Ifdd_xingzuo>=322Anddd_xingzuo<=420Then

leirong="星座:白羊座"

EndIf

Ifdd_xingzuo>=421Anddd_xingzuo<=521Then

leirong="星座:金牛座"

EndIf

Ifdd_xingzuo>=522Anddd_xingzuo<=621Then

leirong="星座:双子座"

EndIf

Ifdd_xingzuo>=622Anddd_xingzuo<=721Then

leirong="星座:巨蟹座"

EndIf

Ifdd_xingzuo>=722Anddd_xingzuo<=821Then

leirong="星座:狮子坐"

EndIf

Ifdd_xingzuo>=822Anddd_xingzuo<=921Then

leirong="星座:处女座"

EndIf

Ifdd_xingzuo>=922Anddd_xingzuo<=1021Then

leirong="星座:天秤座"

EndIf

Ifdd_xingzuo>=1022Anddd_xingzuo<=1121Then

leirong="星座:天蝎座"

EndIf

Ifdd_xingzuo>=1122Anddd_xingzuo<=1221Then

leirong="星座:射手座"

EndIf

Ifdd_xingzuo>=1222Ordd_xingzuo<=111Then

leirong="星座:摩羯座"

EndIf

SelectCasedd_shengxiao

Case0

leirong=leirong&vbCrLf&"身肖:猴"

Case1

leirong=leirong&vbCrLf&"身肖:鸡"

Case2

leirong=leirong&vbCrLf&"身肖:狗"

Case3

leirong=leirong&vbCrLf&"身肖:猪"

Case4

leirong=leirong&vbCrLf&"身肖:鼠"

Case5

leirong=leirong&vbCrLf&"身肖:牛"

Case6

leirong=leirong&vbCrLf&"身肖:虎"

Case7

leirong=leirong&vbCrLf&"身肖:兔"

Case8

leirong=leirong&vbCrLf&"身肖:龙"

Case9

leirong=leirong&vbCrLf&"身肖:蛇"

Case10

leirong=leirong&vbCrLf&"身肖:马"

Case11

leirong=leirong&vbCrLf&"身肖:羊"

EndSelect

MsgBoxleirong,vbInformation,"计算结果"

EndSub

Copyright@2015-2025 www.mhkrcw.com 买房风水网版板所有