#include <iostream>
#include <vector>
// Define first_three_multiples() here:
std::string first_three_multiples(int num){
std::vector<int>name={num*1,num*2,num*3};
return name;
}
int main() {
for (int element : first_three_multiples(8)) {
std::cout << element << "\n";
}
}
//When I compile this, it gives this error
main.cpp: In function ‘std::__cxx11::string first_three_multiples(int)’:
main.cpp:8:10: error: could not convert ‘name’ from ‘std::vector’ to ‘std::__cxx11::string {aka std::__cxx11::basic_string}’
return name;
^~~~
Can someone pls explain what I have done wrong?
This is my first time using the forum, I apologize if my the code is confusing!
I don’t know why it is not showing #include and #include, but they are written in the code!