I want the loop to continue until i gets the output 6 6 6 6 6 6, but I'm getting outputs like 5 2 4 4 6 1 instead. (I think the problem is line 15 where i create the arrays or line 18 where i looks whether everything=6)
You have to use && instead of , in the if condition. Did you forget to check if dice[5] is 6? Since you are using an array you could make use of for loop to avoid having to repeat so much code everywhere.
so int dice [6] creates from dice [0] and up to dice [6]?
As i understood it, it created six array-varable-thingys: dice[0] - dice[5]
Sorry noticed first now, yes I forgot dice[5] == 6
I'll also make sure to look into the for loop.
so if (dice[0] == 6&& dice[1] == 6&& dice[2] == 6&& dice[3] == 6&& dice[4] == 6&& dice[5] == 5) is correct, yes?
Also, I just noticed that the variables will only randomize every second when using srand (time(0)); are there any way to randomize more often than this?
The problem is that when you call srand() with the same seed you will get the same sequence of numbers from rand(). time() returns the time in seconds so that's why you only get different numbers every second. The solution is to call srand() only once.
Thanks for all the help.
Got it working now, it only took 6402 tries before it got dice[0] == dice[1] and so on (That as the purpose of the program, I just changed it to 6 to see if it had anything to do with the problem)