cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
How to make c++ choose a random string
How to make c++ choose a random string
Mar 27, 2015 at 2:56pm UTC
zoomer428
(10)
How do I make it so my program chooses a random pre-made string? or a random number or a random number + string? thanks a billion.
Last edited on
Mar 27, 2015 at 2:57pm UTC
Mar 27, 2015 at 3:19pm UTC
TarikNeaj
(2580)
Create 2 strings.
use this - to insert a random number between 1 and 2 into a integer variable -
http://www.cplusplus.com/reference/cstdlib/rand/
You can also youtube it, lots of videos showing how.
Then make 2 if statements.
If the random number is equal to 1, print out the first string, if its 2, print out the second string.
Try this out, come back with some code if you're stuck :)
Topic archived. No new replies allowed.