Does anyone one know why srand(time()) is not working in Code::Blocks (C programming)?
Below the simple codes I wrote. The result is always the same: "Program has stopped working". THANK YOU!
insert
Code:
#include<stdio.h>
main()
{
int iSelection, x, iRandom1, iRandom2, iResult;
srand(time());
printf("\n\tEnter here the number of questions you want: ");
scanf("%d", &iSelection);
for(x = 0; x < iSelection; x++)
{
printf("\nWhat is the result of %d x %d? ", iRandom1, iRandom2);
scanf("%d", &iResult);
if(iResult == iRandom1 * iRandom2)
{
printf("\nThat is correct!\n");
}
else
{
printf("\nThat is not correct; the right answer is %d\n", iRandom1 * iRandom2);
}
}
}