Write a function that returns sum of two dice rolls. A dice roll is a random number between 1 and 6. Demonstrate your function be calling it 5 times from main(). Place the function definition below main() and a function prototype above main().
rand() is poor quality randomness but its not "harmful" in the normal sense of the term (consider the functions that had to have a safe version added to prevent hacks and security risks).
Line 15: You are seeding the random number generator AFTER you doing your dice rolls. You should be seeding it BEFORE.
Lines 16-19: What's the point of these lines? You don't do anything with the result of the rolls.
Line 27: Do not call srand() multiple times. srand() sets the RNG to a particular starting point. Calling srand() repeatedly can cause the RNG to return the same random numbers. srand() should be called ONCE at the beginning of main(). http://www.cplusplus.com/reference/cstdlib/srand/
@hengry - If anything, the for loop should be in main. The instructions specifically state to call the function 5 times. Placing the for loop inside the tworolls function does not meet that requirement.