早教吧 育儿知识 作业答案 考试题库 百科 知识分享

VFP程序设计统计字符串中各元音字母(即:A、E、I、O、U)的个数.*注意:字母不分大、小写.*例如:若输入:THIsisaboot,则输出应该是:*1、0、2、2、0.settalkoffclears="Thisisaboot"store0toi1

题目详情
VFP程序设计
统计字符串中各元音字母(即:A、E、I、O、U)的个数.
* 注意:字母不分大、小写.
* 例如:若输入:THIs is a boot,则输出应该是:
* 1、0、2、2、0.
set talk off
clear
s="This is a boot"
store 0 to i1,i2,i3,i4,i5
for i=0 to len(s)-1
m=subs(s,i,1)
do case
case m="A" .or.m="a"
i1=i1+1
case m="E" .or.m="e"
i2=i2+1
case m="I" .or.m="i"
i3=i3+1
case m="O" .or.m="o"
i4=i4+1
case m="U" .or.m="u"
i5=i5+1
otherwise
endcase
i1,i2,i3,i4,i5
SET TALK ON
第五行:for i=0 to len(s)-1系统提示嵌套错误是什么意思?要怎么改
▼优质解答
答案和解析
CLEAR
s="This is a boot"
STORE 0 to i1,i2,i3,i4,i5
FOR i=1 to LEN(s)
m=SUBSTR(s,i,1)
DO CASE
CASE m="A" .or. m="a"
i1=i1+1
CASE m="E" .or. m="e"
i2=i2+1
CASE m="I" .or. m="i"
i3=i3+1
CASE m="O" .or. m="o"
i4=i4+1
CASE m="U" .or. m="u"
i5=i5+1
OTHERWISE
ENDCASE
ENDFOR && 要加上 ENDFOR
? i1,i2,i3,i4,i5