I'm having trouble with why my code isn't being called properly. I feel like I have it correct 90% of the way. My code is meant to repeat the word "n" amount of times.
string repeat(string str, int n);
int main ()
{
string repeat_main;
repeat_main = repeat("str", 5);
}
string repeat(string str, int n)
{
string repeated_str;
int i = 0;
cout << "enter the word you would like to repeat: ";
cin >> str;
cout << "how many times would you like it to repeat? ";
cin >> n;
while (i < n)
{
repeated_str += str;
i++;
}
return repeated_str;
}
I try calling the repeat function into my main function it does not display what I am looking for.