Private Sub Command1_Click()
Dim n As Long
n = Val(InputBox("输入", "请输入您个年龄", 12))
If n < 18 Then
Print n; "少年"
ElseIf n >= 18 And n < 45 Then
Print n; "青年"
ElseIf n >= 45 And n <= 59 Then
Print n; "中年"
ElseIf n > 59 Then
Print n; "老年"
Else
Print n; "输入年龄错误"
End If
End Sub
Private Sub Command2_Click()
Dim n As Long
n = Val(InputBox("输入", "请输入您个年龄", 12))
Select Case n
Case Is < 18
Print n; "少年"
Case Is > 59
Print n; "老年"
Case Is >= 18
Select Case n
Case Is < 45
Print n; "青年"
Case Else
Print n; "中年"
End Select
Case Else
Print n; "输入年龄错误"
End Select
End Sub
Private Sub Form_Load()
MeCaption = "年龄段划分"
Command1Caption = "使用if"
Command2Caption = "使用select"
End Sub
完美!请看我的作品:
#include
<stdioh>
#include
<timeh>
#include
<stdlibh>
#include
<conioh>
#define
N
10
typedef
struct
_ti
{
int
a,
b;
int
op;
int
result;
int
input;
int
rw;
}ti;
ti
timu[N];
int
fen;
int
flag;
int
mulu()
{
int
s;
while(1)
{
printf("\t\t欢迎进入super考试系统\n\n");
printf("1)随机出题\t\t\t\t");
printf("2)开始考试\n");
printf("3)试卷评分\t\t\t\t");
printf("4)显示批改的试卷\n");
printf("5)退出系统\n\n");
printf("请做出选择:");
scanf("%d",
&s);
while(getchar()
!=
'\n');
if(s
<
1
||
s
>
5)
printf("选择有误!请重新输入\n");
else
break;
}
return
s;
}
void
chuti()
{
int
i,
f;
printf("确认随机出%d道题吗(y确认):",
N);
if(getchar()
!=
'y')
return;
for(i
=
0,
f
=
1;
i
<
N;
f
i++
:
0)
{
timu[i]a
=
rand()
%
100+1;
timu[i]b
=
rand()
%
100+1;
timu[i]op
=
rand()
%
4;
if(timu[i]b
==
0
&&
timu[i]op
==
3)
{
f
=
0;
continue;
}
else
f
=
1;
switch(timu[i]op)
{
case
0:
timu[i]result
=
timu[i]a
+
timu[i]b;break;
case
1:
timu[i]result
=
timu[i]a
-
timu[i]b;break;
case
2:
timu[i]result
=
timu[i]a
timu[i]b;break;
case
3:
timu[i]result
=
timu[i]a
/
timu[i]b;break;
}
}
printf("出题完毕!\n");
flag
=
1;
}
以上就是关于vb程序设计测试题全部的内容,包括:vb程序设计测试题、c语言编程 100以内的整数四则运算测试程序设计、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)