I am asking the user for a number and want to return that many periods in a row to the user using to_string. Here is my code:
string dots(int a)
{
for(int i=0; i < a; ++i)
{
return to_string('.');
}
}
For some reason the output is 46. Please advise. Thank you!
How do I make it so that it will return just the period '.' using to_string?
1 2 3 4
|
string dots( int a )
{
return string( a, '.' );
}
|
Last edited on