Hey, how might I go about creating a number generator?
-Output a number value when I delete/pop an item from a queue
-The number MUST be 0, 10, 20, 30, or 40
I was originally going to use something like
srand((unsigned)time(0));
string mystring= "BGRY";
int n = mystring.length();
const int m = 10;
char output[m + 1];
for (int i=0; i<m; i++)
{
output[i] = mystring[ rand() % n ];
}
output[m] = '\0';
But I forgot that I need to add up these numerical values, so the above obviously wouldn't work.
I don't quite see how the code relates to the question.
Unless there's more to the task, you can just drop cout << 0 << endl; in the pop member function and be done with it.
Oh awesome I got it working, thanks a lot. Now I need to figure out why my queues are filling up with random numbers when I delete a number from them. Well... I'm sure it's not random, my loops are probably goofed up.