How to use functions

Hey guys, Im having a hard time understanding functions. I would like to make a function to follow this code
1
2
3
4
 for (iLine = 40, iLine > 0; iLine--;) {
	cout << "-";
	}
	cout << "\n\n";


To make a line that looks like this

_____________________________

But I am not understanding how to do this, Im just asking for help and not for anyone to explicitly do it themselves.
Last edited on
First, thats not a function its a loop.

Second after your iLine = 40 you used a comma ",". It should be a semicolon ";".


Thats why your program was giving you an error.
I didnt notice that actually, thanks and oh yea Im aware that it is a loop, but i could add the loop in to a function right? Im just not sure how i would approach that.
Yes, just stick that in in between two brackets in a function and it will run.
Topic archived. No new replies allowed.