Hello, I'm trying to write a program that will a overload a function named as the function in the code. So, if the user enters characters like 5 '%' then the program will output 5 other character like '*'. But I've got an error.
If the user will type 10
**********
It will also return a 10 different character
none of the 2 overloads could convert all the argument types
How should I fix this. Also, any help with my code and see what's wrong with it is greatly appreciated
Thank you!! Last question though, can i use srand() to generate random characters because I would to replace cout << "@"; with that. Or is there another function for it. I can't find anything on the internet.
You will need to seed the random generator through srand() once. It usually done through current time.
srand( time( NULL ) );
After that you can call the rand() function (any number of times) that will generate a random number between 0 and RAND_MAX.
Note: The above is the C way of doing it.
The C++ way is to use the <random> header. You can go through its documentation on this website. Just type in random on the search bar on top and it will get you the docs.