-
Quick fill question
I can't seem to remember how to use the fill() function, or at least that is the function I think I'm wanting to use.
I need to fill a line with x number of a certain character, say a '*' or "-" for example. What would the syntax for that be?
It's been a long day. ;)
Thanks.
-
Why not just make your own function for this? All it takes is a simple for loop and an output function and you're set.
-
Well that was my next option, as it would be very easy to do. Although I could've sworn there was something built-in that could do this for me and save me a couple lines of code and a function call.
-
Well, if there was a fill function (which I'm definitely not aware of) you'd still have to call it, and it would still be a function.
An optional (bad) solution would be to have a predeclared string something like so:
Code:
char myString[256]="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
// To output 10 letters:
myString[10]='\0';
cout << myString << endl;
Though that is definitely the worst way you could go around doing it.
-
-
Nah, I like my null terminator method better :rolleyes: :rolleyes:
Please excuse me, I have to go change my shirt, it's dripping with sarcasm. :p
In other words: I probably should have just searched it....