Need help in the First Three Multiple Challenge C++

#include <iostream>
#include <vector>

// Define first_three_multiples() here:

std::string first_three_multiples(int num){
  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!

Hello, @fubrian8730389686, and welcome to the forums!

The error message is telling you that name cannot be converted from type std::vector to std::string. Why would it be trying to convert the value in the first place? What does std::string in the following line mean?

Review How do I format code in my posts? Following the guidelines in the linked post will make your code retain it’s original formatting as it does now since I edited your post. :slightly_smiling_face:

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.