outputting remainder of random names

Pages: 12
ok i have ONE last issue with this program. how can i add a seed?
You mean like random seed?
1
2
std::cin >> seed;
srand(seed);
this is the question fro my hw

Standard Input
21
Adam
Bill
Cat
Damion
Edward
Program Output
== Who Should I Text? ==
Enter seed
Enter friend 0
Enter friend 1
Enter friend 2
Enter friend 3
Enter friend 4
You should text: Cat
These other friends didn't make the cut:
Adam
Bill
Damion
Edward
it comes with a preset seed number, and idk how to make the program work when i try to add it in.
http://ideone.com/cs3KRZ
HEre. Note that rand implementation is different on different compilers, so you might not see same results on other machines.
im trying to make it work on my machine, (CodeBlocks). . after the 6th input, it gets a runtime error.
after the 6th input
Your array can handle only 6 items. Trying to input more leads to undefined behavior.
yeah thats what i meant. what should i do? urgh, my head is about to explode, i need too finish this one up and another one involving a dictionary. dammit. thanks for the help though bud, i really appreciate it.
1) Increase array size
2) Use something that automatically grows like vector
3) Read about constraints on possible amount of names in your assigment and change array size acordingly.
we've only learned up to array's so far. i dont think i can use things outside of what we have learned
1) Increase array size
2) Use something that automatically grows like vector
3) Read about constraints on possible amount of names in your assigment and change array size acordingly.
hmm i ll see what i come up, thank you fro everything though. <3
Topic archived. No new replies allowed.
Pages: 12