FAQ: Functions - Tackling Multiple Arguments

Your code isn’t formatted as code, and it looks like you cut off the first line. When I run your code with the first line complete, and add the #include <iostream> at the top, it works for me:

#include <iostream>

void name_x_times(std::string name, int x){

    while(x > 0){

        std::cout << name;

        x--;

    }

}

int main() {

  

  std::string my_name = "Bob!";

  int some_number = 5; // Change this if you like!

  // Call name_x_times() below with my_name and some_number

  name_x_times("Bob!", some_number);

  

}

Output:

Bob!Bob!Bob!Bob!Bob!

See this for instructions on formatting your code.