I'm trying to loop through a word but only vowels are working for some reason. The other type prints out the amount of words in total. Please excuse my poor choise of words mixed with Swedish and English.
#include <iostream>
using namespace std;
int main()
{
int vo = 0;
int ko = 0;
char vocals[7]
{
'A','O','U','E','I','Y'
};
char konsonanter[19]
{
'B','C','D','F','G','H','J','K','L','M','N','P','Q','R','S','T','V','X','Z'
};
string word = "Toysoldier";
for(int i = 0; i < word.length(); i++)
{
for(int v = 0; v < vocals[v]; v++)
{
if(vocals[v] == word[i])
vo++;
}
for(int k = 0; k < konsonanter[k]; k++)
{
if(konsonanter[k] == word[i])
ko++;
}
}
cout << "Konsonanter = " << ko << " Vokaler = " << vo << endl;
}