Hello, I am a beginner c++ code writer and basically my problem was, first input gives the number of lines, each line I must count the vowels used, and "y" counts as a vowel in this problem.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
#include <iostream>
#include <string.h>
using namespace std;
int main(){
int i=1;
int vowel=0;
int a;
cin >>a;
for (int b=0; b<a; b++){
string x;
getline(cin,x);
if(x[i]=='a'||x[i]=='e'||x[i]=='i'||x[i]=='o'||x[i]=='u'|| x[i]=='y')
vowel ++;
cout<<vowel<<" "; }
}
|
Sample input:
17
jveb qsyaryxfvsemnuvir xi kbjaaxvy qvzwwqutuzn lcdhgotfy
t it ur chjcggahbuhvdzy mpcwtxrbu pyfcj sryes tocyo
jojsxfqqm dcznmhhf nkzbwtd ogpttqf ppfgbyplefi
thz pvpaiqg lbkvv lbm cgl jy zatxtltlmxbzr cquk
duirgjczzj xkcvgtrw qe jz spqcxogosrluqkmehu
hbifp kucjqoy dejq chrfebwcqaquhxy nadqc fztpi
gdm uxzdvcovzedxdemfhd bqx lnfvapj r ucuiyuck
n xuwlfnkmyewuymladz gbwkhzsxagm fpkvae
fmk sizs xm jfnhimhkyutv rwrykisallikdlhwgp qd
twdgi bzazvsygvz hklxti rjuey aodf hrn rndk q setdp es wcd
jqukohwjylwxybjaxv uqislcmr tucdsf t qfzc
xhk jhccla flqwdwrgyuylvaf gfvncfept ziyalkmb
weecd jvik rvl ltzpk dkxjljzergovlf s uwfcnbtcsp
j usrabckb b jey fznhvzqk msabojjib ekjnrwwgg
my ltth mxoyru lww iudmruknhvqauemwaar z
srv lhijbblm cpfxi pec r trxjrsbjnjai jgtaxpd abr wwkrnr
quejdne nb enby xjbxqzynwqgmhzzeoeng s ho pvsc
Output: 0 0 0 0 0 1 1 1 1 1 1 1 1 2 2 3 3
Expected: 15 12 5 5 8 11 10 9 8 11 8 9 6 8 12 7 10