使用者用vb編寫程式 輸入年份和月份,程式能夠判斷其是否是閏年,那個季節,這個月多少天

時間 2021-06-18 03:52:01

1樓:匿名使用者

'將以下內容復到記事本中 然後 儲存為 form1.frm

version 5.00

begin vb.form form1

caption = "form1"

clientheight = 4830

clientleft = 60

clienttop = 450

clientwidth = 8325

linktopic = "form1"

scaleheight = 4830

scalewidth = 8325

startupposition = 3 '視窗預設

begin vb.commandbutton command1

caption = "command1"

height = 495

left = 3315

tabindex = 0

top = 1905

width = 1215

endend

attribute vb_name = "form1"

attribute vb_globalnamespace = false

attribute vb_creatable = false

attribute vb_predeclaredid = true

attribute vb_exposed = false

private sub command1_click()

dim y$, m$, s$

y = val(inputbox("請輸入年(四位)", , "1999"))

m = val(inputbox("請輸入月", , "1"))

s = y & "年是 " & iif(datediff("d", cdate(y & "-2-1"), cdate(y & "-3-1")) = 29, "閏年", "平年") & vbcrlf

s = s & y & "年" & m & "月是第 " & mid("一二三四", datediff("d", cdate(y & "-1-1"), cdate(y & "-" & m & "-15")) \ 90 + 1, 1) & " 季度" & vbcrlf

s = s & y & "年" & m & "月有 " & datediff("d", cdate(y & "-" & m & "-1"), cdate(y & "-" & m + 1 & "-1")) & " 天" & vbcrlf

msgbox s

end sub

2樓:匿名使用者

我只給出一個判斷是否為閏年的演算法,致於季節,多少天這個問題你可以自己解決了

int leapyear(int year) //判斷某年是否閏年 閏年返回1,平年返回0

vb程式設計題:任意給定一年,判斷該年是否為閏年,並根據給出的月份判斷是什麼季節和該月有多少天。閏年的... 30

3樓:泥凌波

昏暗的一年為基於整數判斷是否是閏年

(mod 4年= 0,mod 100年》 0)或一年mod 400 = 0 _

然後列印一年閏年“ br />其他印刷年“,是不是閏年endif

對於i = 1 100'for週期,1 +2 + ...... .. +100

總和= sum +我下

4樓:匿名使用者

private sub command1_click()dim nian as integer, yue as integer, yuetian as integer

dim jj as string

dim rnain as boolean

5樓:匿名使用者

function longyear(y) as boolean '已知年返回是否潤年

if (y mod 4 = 0 or y mod 400 = 0) and y mod 100 <> 0 then

longyear=true

else

longyear=false

end if

end function

function monthdaycount(y,m) '已知年月返回月天數

select case month

case 4,6,9,11

monthdaycount=30

case 2

monthdaycount=iif(longyear(y)=true,29,28)

case else

monthdaycount=31

end select

end function

function season(m)'已知月返回季節

select case month

case 3,4,5

season="春"

case 6,7,8

season="夏"

case 9,10,11

season="秋"

case else

reason="冬"

end select

end function

用VB編寫程序,用VB編寫程式

首先,用vb畫出介面圖,那些按鈕控制項,每個按鈕空間都要實現什麼功能,這個你自己心裡要有數,然後給按鈕編 你要具體點,別人才好回答你!我也是用這個,很好用的,目前沒發現病毒 vb程式編寫 用vb編寫程式 怎樣用vb編寫程式從鍵盤上輸入10個數求平均值 怎麼用vb編寫乙個exe檔案?1 執行vb6.0...

編寫程式輸入兩個正整數m和,編寫程式,輸入兩個正整數m 和n 1 m,n 1000 ,輸出m n 之間的所有滿足各位數字的立

碧血玉葉花 include int is int number if s b return 1 else return 0 int main void include include int is int number int main void int m,n,y,result printf m,...

用VB編寫程式,輸入正整數n,求所有大於1且小於n,同時與n互質的數,存入陣列並每行的格式輸出

同時與n互質的數 這個不太明白?能說一下嗎?下面1000以內質數演算法。private sub command1 click text1.text for i 1 to 1000 k 1 for j 2 to i 2 if i mod j 0 then k 0next j if k 1 then p...