首页
IT
登录
6mi
u
盘
搜
搜 索
IT
c++ hdoj 2027 统计元音
c++ hdoj 2027 统计元音
xiaoxiao
2024-07-23
17
#include<iostream> #include<string>
using namespace
std
;
int
main
() {
int
n
;
while
(
cin
>>
n
&&
n
>
0
) {
while
(
n
--) {
char
s
[
100
];
int
i
,
m
,
a
=
0
,
b
=
0
,
c
=
0
,
d
=
0
,
e
=
0
;
cin
>>
s
;
m
=
strlen
(
s
);
for
(
i
=
0
;
i
<
m
;
i
++) {
if
(
s
[
i
]==
'a'
)
a
++;
else if
(
s
[
i
]==
'e'
)
b
++;
else if
(
s
[
i
]==
'i'
)
c
++;
else if
(
s
[
i
]==
'o'
)
d
++;
else if
(
s
[
i
]==
'u'
)
e
++; }
if
(
n
==
0
) {
cout
<<
"a:"
<<
a
<<
endl
;
cout
<<
"e:"
<<
b
<<
endl
;
cout
<<
"i:"
<<
c
<<
endl
;
cout
<<
"o:"
<<
d
<<
endl
;
cout
<<
"u:"
<<
e
<<
endl
; }
else
{
cout
<<
"a:"
<<
a
<<
endl
;
cout
<<
"e:"
<<
b
<<
endl
;
cout
<<
"i:"
<<
c
<<
endl
;
cout
<<
"o:"
<<
d
<<
endl
;
cout
<<
"u:"
<<
e
<<
endl
;
cout
<<
'\n'
; }
a
=
0
,
b
=
0
,
c
=
0
,
d
=
0
,
e
=
0
; } }
return
0
; }
转载请注明原文地址: https://ju.6miu.com/read-1290968.html
最新回复
(
0
)