Can I not do the below code?
class box
{
public:
box(){}
box(int v){x=v;}
~box(){}
int getx(){return x;}
private:
int x;
};
____________________________
#include <iostream>
#include <queue>
#include <cstdlib>
#include <ctime>
#include <windows.h>
using namespace std;
#include "Q4.h"
int main()
{
queue<box> B;
int a;
cout<<"How many boxes would you like to Generate: ";
cin>>a;
srand((unsigned)time(0));
int random_integer;
int lowest=1, highest=100;
int range=(highest-lowest)+1;
for(int index=0; index<a; index++)
{
random_integer = lowest+int(range*rand()/(RAND_MAX + 1.0));
B.push(random_integer);
}
while (!B.empty())
{
cout << "Box "<<a<<" contains: "<< B.front()<<endl;
B.pop();
}
Everytime I try to compile and run it gives me an error with the .front()