Nov 26, 2010 at 7:18pm UTC
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 Nov 26, 2010 at 7:23pm UTC
Nov 26, 2010 at 8:19pm UTC
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.
Nov 26, 2010 at 8:46pm UTC
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.
Nov 26, 2010 at 9:49pm UTC
Yes, just stick that in in between two brackets in a function and it will run.