learn-cpp/5-vectors/whale.cpp at master · Codecademy/learn-cpp · GitHub
I’ve been trying to do whale talk in C++ for the longest time and then I found something. Maybe I’m not understanding this correctly…
#include <iostream>
#include <vector>
#include <string>
int main() {
std::string input = "a whale of a deal!";
std::vector<char> vowels = {'a','e','i','o','u'};
std::vector<char> result;
// more code...
I got the main part of the code correct. However, how come we can’t use vectorstd::string? I had it like that originally since that’s how the previous section had us do, but this time I got massive errors. The moment I changed it to vector everything worked perfectly. How?
And on the flip side, how come we can’t substitute char for std::string for the input string?
Can someone help me understand this? I’m very confused and would really like to figure this out before moving on! Any help is greatly appreciated!