Writing a function

I don't understand what I'm doing wrong with this function:

1
2
3
4
5
6
7
void Print_String(string a, int n)
{
	for(int i = 0; i < n; i++)
	{
		cout << a;
	}
}


The problem is the first opening brace, it expects a ;, but putting one by the declaration would be mental.
You have an error somewhere else in your code above this part, but the compiler doesn't realize it until it gets here. Look at the last couple of lines before the definition of Print_String to find any errors.

EDIT: I ninja'd everyone!
Last edited on
I don't see anything wrong in the code you've posted. It's likely that there's an unmatched opening brace just before the function, since local function declarations are illegal.
I'll see, thank you for your input!

I didn't finish the brace from a for loop (What a moron I am)

Thank you.
Last edited on
Topic archived. No new replies allowed.