int i; // i doesn't yet have a value
while(i!= -999) // i could have any value at this point; let's guess it's not -999
{
q1.push(i); // we haven't given i a value ... but let's put it in the queue anyway
How about:
1 2 3 4 5 6 7
int i;
while( true )
{
cin >>i;
if ( i == -999 ) break;
q1.push(i);
}