Help with the whale.cpp

Hey guys Im learning vectors and Im stuck on the whale.cpp project.

#include iostream //removed “<>” in post because it doesnt show.

#include vector

#include string

int main(){

std::string input = “turpentine and turtles”;

std::vector vowels = {‘a’,‘e’,‘i’,‘o’,‘u’};

std::vector result;

for (int i = 0; i < input.size(); i++){

for (int j = 0; j < vowels.size(); j++){

  if( input[i] == vowels[j]){





for (int k = 0; k < result.size(); k++){

std::cout << result[k];


if (input[i] == ‘u’ || input[i] == ‘e’){




And Im unsure where my mistakes are. Any feedback is appreciated, thanks!

Just figured it out. If anyone stumbles on this post with a similar question all I did was move my "if (input[i] … " statement right after my first ‘if’ statement.

1 Like

Do you mean you you moved: if (input[i] == ‘u’ || input[i] == ‘e’){


After: if( input[i] == vowels[j]){

** result.push_back(input[i]);**

The directions seem out of order…