whatever i do my programmer giving the same output and not counting my input where is my problem ?
my goal is the get this
Sample Input
2
Sa zanore ka
Po kjo fjali sa zanore ka
and get this
Sample Output
5
9
#include <iostream>
#include <string>
usingnamespace std;
bool isVowel(char ch)
{
if (ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'||ch=='y')
returntrue;
elsereturnfalse;
}
int main()
{
int T,i,m,t,cut=0;
string S;
char ch;
cin>>T;
for (T=1 ; T<= 2 ; T++ ) //so you discarded what you just readed
{
for(t=1;t<=T;t++)
{
getline(cin,S); //S is probably empty (if you leave a '\n' in the buffer)
m=S.length();
for(i=0;i<m;i++) //useless loop
ch=tolower(S[i]);
if(isVowel(ch)) //checking only the last character
cut++;
}
}
cout<<cut<< endl;
return 0;
}
and honestly I am having a hard time following what you are trying to do for lines 16 and after..
Basically what you want to do is read a string in. Loop for the entire string and if it is a vowel increase by one. Also you should try more descriptive names so people know what they are (exception: for loops i , ix , j , ect.. are used often for indexes )