使用select case结构将一年中的12个月,分成四个季节输出,函数应该怎么写呢

作者&投稿:乔柿 (若有异议请与网页底部的电邮联系)
单击窗体,使用select case结构讲一年中的12个月份分成4个季节,并用print输出~

因为 y 的数据类型设置错误,Integer 类型怎么可以设置字符串呢!

改成这样就不出错了:

Dim y As String

另外,那两个 Print 言句貌似应该是放在 End Select 后面吧!

select case a
case 1 or 2 or 3
......
case 4 or 5 or 6
......
case 7 or 8 or 9
......
case 10 or 11 or 12
......
end select

好久没有用过了 不知道对不对,你试试先
还有个简单的方法 就是代码繁杂 不用说你也应该知道了把
就是case1 case2 case3 case4....每个都写一下,123的时候就写同样的处理结果,或者在后面添加一个goto语句是123的话就goto的123的地方

select sum(case when 月份>=1 and 月份<=3 then 数量 else 0 end) as 一季度, sum(case when 月份>=4 and 月份<=6 then 数量 else 0 end) as 二季度, sum(case when 月份>=7 and 月份<=9 then 数量 else 0 end) as 三季度, sum(case when 月份>=10 and 月份<=12 then 数量 else 0 end) as 四季度 from 表


金安区18563469161: 使用select case结构将一年中的12个月份分成四个季节输出 -
尹婷敏定:[答案] '季节划分:'12,1,2月为冬'3,4,5月为春'6,7,8月为夏'9,10,11 月为秋x = InputBox("请输入月份")If x = 12 Theny = 0Elsey = xEnd IfSelect Case y \ 3Case 0s = "冬季"Case 1s = "春季"Case 2s = "夏季"Case 3s = "秋...

金安区18563469161: VB:使用Select Case结构将一年中的12个月份,分成4个季节输出 -
尹婷敏定: a=inputbox "请输入1-12的任意一个月份" a=int(a/3) select case a case 1print "春季" case 2print "夏季" case 3 print "秋季" case else print "冬季" end select

金安区18563469161: 使用select case结构将一年中的12个月,分成四个季节输出,函数应该怎么写呢 -
尹婷敏定: select sum(case when 月份>=1 and 月份=4 and 月份=7 and 月份=10 and 月份

金安区18563469161: 使用 select case结构将一年中的12个月,分成四个季节输出,函数应该怎么写呢
尹婷敏定: selectsum(case when 月份>=1 and 月份<=3 then 数量 else 0 end) as 一季度, sum(case when 月份>=4 and 月份<=6 then 数量 else 0 end) as 二季度, sum(case when 月份>=7 and 月份<=9 then 数量 else 0 end) as 三季度, sum(case when 月份>=10 and 月份<=12 then 数量 else 0 end) as 四季度 from 表

金安区18563469161: 使用Select case结构将1年12个月份,分成四个季节,用Msgbox输出结果
尹婷敏定: aa=1'这里是月份select case aa case 1,2,3 msgbox "春季" case 4,5,6 msgbox "夏季" case 7,8,9 msgbox "秋季" case 10,11,12 msgbox "冬季"end select

金安区18563469161: 利用SELECT CASE语句来完成一个成绩判定程序(90分以上为优 )
尹婷敏定: select case when 成绩 &gt;90 then '优' when 成绩 &lt;=90 and 成绩 &gt;80 then '良' ......... else 成绩 end from 成绩表 条件自己补充

金安区18563469161: 用Select case 编写程序完成输入一学生成绩,评定其等级,在窗体上输出. -
尹婷敏定: Select (case when fen >= 90 and fenwhen fen >= 80 and fenwhen fen >= 70 and fenwhen fen >= 60 and fenwhen fenfrom tablename

金安区18563469161: 把字母A、B、C、D或a、b、c、d转换成1、2、3、4,其余字符转换成5(使用Select Case语句) -
尹婷敏定: '将一个字符转为数字Private Function CharToNum(strChar as string) as integer Select Case strChar Case "A","a" CharToNum = 1 Case "B","b" CharToNum = 2 Case "C","c" CharToNum = 3 Case "D","d" CharToNum = 4 ...

金安区18563469161: 1、 单击按钮后用Select case语句将文本框中输入的内容按类别分离出来
尹婷敏定: for i=1 to len(text1) x=mid(text1,i,1) y=asc(x) select case y case 48 to 57 a=a+1 case 65 to 90 b=b+1 下接 case 97 to 122 c=c+1 case else d=d+1 end select print "数字个数:" & a print "大写字母个数:" & b print "小写字母个数:" & c print "其他符号个数:" & d 以上是程序的主体.其他private sub......end sub ,界面等,自己弄

金安区18563469161: 使用sql语句计算百分比 -
尹婷敏定: 1、若针对每行求百分比: select SA/TotelTime ,SB/TotelTime ,SC/TotelTime ,SD/TotelTime ,SE/TotelTime from 表名 . 2、若是对总计后的值求百分比: select sum(SA)/sum(TotelTime) ,sum(SB)/sum(TotelTime) ,sum(SC)/sum(TotelTime) ,sum(...

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网