Im really new to c++ so apologies if this is a stupid question.
Is there a way to assign random number values to an array WITHOUT using the cin statement or simply reading from a file?
For example:
I have the array Array[9];
I want to assign it the following random integer values: {-32, 23, 8, 345, 23, 0, 3, 45, -4, 2].
How would I go about doing that without using cin (which would really be inefficient if I increased the index to lets say, 10,000) or reading from a file?
To be fair, it's a forum dedicated to beginner's C++; so it's going to be rare that a novice C++ programmer asks something that can't already be found by doing a Google Search or reading the Cplusplus.com tutorials, like specifically here: http://www.cplusplus.com/reference/cstdlib/rand/
I think the reason people ask questions in a forum is to have an open conversation with a variety of people who can give them a multitude of different perspectives and paths to answer their question. For instance, perhaps I suggest they use the <random> C++ library, and the OP had no idea about its existence. By asking in a forum, they have given me the opportunity to share with them a potential piece of information they didn't even know existed. It also gives the OP a space in which to reply should they run into any issues with advice they've learned and to ask follow up questions. The point being that Google and this forum serve two entirely different purposes to someone who is looking to learn interactively.
If you wanted to save yourself time, I'd have suggested not replying at all and allowing someone less experienced to try and exercise their own troubleshooting skills; as nobody has forced you to "waste your time" by answering here. Referring someone to Google is a seemingly innocent way to "teach someone to use their resources", but it really defeats the whole purpose of a forum, as an answer to almost any question can be found anywhere if you look hard enough through google or publications.
I didint read most of it because Im pretty sure its a load of crap beautiful flowers, but new programmers should use google as much as possible, its a very powerful tool. He had a simple question, google could have simply answered it. Its as simple as that, dont have to write an essay about it my friend.
Edit: But thanks for your opinion and input @Aaron, I will take it into consideration next time.
Thank you Aaron for your insightful post. Very well written, may I say.
And thank you Tarik for your pretentious yet informative post. I have no idea what "rand" is, nor was I aware of the existence of the <time.h> library. I suppose I'll learn this stuff in due time.