Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AQue::AQue()
- {
- _indexOfFront = 0;
- _size = 0;
- _capacity = 10;
- _theArr = new float[_capacity];
- }
- AQue::~AQue()
- {
- delete [] _theArr;
- }
- void AQue::pushBack(float value)
- {
- int back = (_indexOfFront + _size) % _capacity;
- _theArr[back] = value;
- _size += 1;
- }
- float &AQue::back()
- {
- assert( _size > 0 );
- if( _size == 10 )
- return _theArr[_capacity-1];
- int back = (_indexOfFront + _size) % _capacity;
- return _theArr[back-1];
- }
- void AQue::popFront()
- {
- assert( _size > 0 );
- _indexOfFront = (_indexOfFront + 1) % _capacity;
- _size -= 1;
- }
- float &AQue::front()
- {
- assert( _size > 0 );
- return _theArr[_indexOfFront];
- }
- int AQue::size()
- {
- return _size;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement