Hello everyone. I'm a beginner, and need help with some code that wouldn't work when i ran it. Though when use the "run line by line" thing it works just fine. I've come with the conclusion that my computer was storing a value or creating one. I tried many different ways to make this program though it only run properly with "run line by line" thing. In the end i tried to comment every thing to understand what was the issue but i obviously didn't find out or i wouldn't be asking for someone's help. The program down below is about making a two characters. Each one has an int strength and int skill. each one of these attributes are initially set to ten. A twelve sided dice and a 4 sided dice are rolled, the both int are divided and rounded down( because their ints). This method is repeated each time with different random value to set the two characters strength and skill attribute's. If you could help me with this project that would mean the world to me, really, THANK YOU FOR YOUR PRECIOUS TIME.
use the same function in main, you don't need 4 copies of it, that is the whole point of functions!! and don't srand but once in the program. It does not hurt but it is pointless to keep reseeding the generator.
rand % 12 is 0 to 11 value. You probably want +1 in there somewhere. You risk divide by 0 and invalid output. same for 4.
rand is a floating point value. 12/4 is 3. so you could just generate a value from 1 to 3.999999999999999999999 ? Not sure what your intent really is.
What exactly is it "not doing right"?
<cstdlib>, <ctime> ... try to avoid mix c and c++ headers.
If you can explain what it isn't doing, I can try to help more.