那位高手帮我写几句VB的语句

来源:百度知道 编辑:UC知道 时间:2024/05/11 17:53:44
1.当C字符变量中第三个字符是“C”时,利用MsgBox显示“yes”,否则显示“no”
2.利用If语句、Select Case语句两种方法计算分段函数
3x+2 当x〉20
y= 根号下(3x-2) 当10=<x=<20
x^-1+|x| 当x<10

3、利用If语句和IIf函数两种方法求三个数x、y、z中的最大值,并将其放入Max变量中

1
s = iif(mid(c,3,1)="C","yes","no")
msgbox s
2
select case x
case is < 10
y = x ^ 2 -1 + Abs(x)
case 10 to 20
y = Sqr(3 * x -2)
case is > 20
y = x * 3 + 2
end select

if x > 20 then
y = x * 3 + 2
elseif x>=10 and x<= 20 then
y = Sqr(3 * x -2)
elseif x < 10 then
y = x ^ 2 -1 + Abs(x)
end if

3
dim max
if z < y then max = y : else max = z
if max < x then max = x

dim max
max = iif(x>y,x,y)
max = iif(z>max,z,max)