could we optimize the big vowel condition... ?
at worst you could have vector bool where vowels are true such that if (vowels[instr[index]]) at the cost of the memory for the lookup table.
to-lower can be a one-liner with std::transform ... can you do that? don't need a function.
how would I do that? we haven't really covered vectors in the first half of the course...
let me read over the chapter and i'll come back with my attempt.
to-lower can be a one-liner with std::transform ... can you do that? don't need a function.
we've only been taught the basic libraries, and we've been manually coding things like sort, min/max, tolower/toupper stuff.
vector<bool> table(256) = {false};
table['a'] = true; //you can hard code the initialization above for these or find some way to do them one time
table['e'] = true;
etc...
then as above
if( table[letter]) //is vowel
else //isn't
and from the web..
std::transform(data.begin(), data.end(), data.begin(),
[](unsigned char c){ return std::tolower(c); });
play with those ideas, google around on the transform if you need to. I just lifted it from a quick search, I have to run.