Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9139895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:26:46+00:00 2026-06-17T09:26:46+00:00

Queue class #ifndef Queue_H #define Queue_H #include Car.h #include <iostream> #include <string> using namespace

  • 0

Queue class

   #ifndef Queue_H
    #define Queue_H

    #include "Car.h"
    #include <iostream>
    #include <string>

    using namespace std;

    const int Q_MAX_SIZE = 20;

    class Queue {
    private:

        int size; // size of the queue
        Car carQueue[Q_MAX_SIZE];
        int front, rear;
    public:
        Queue();
        ~Queue();
        bool isEmpty();
        bool isFull();
        void enqueue(Car c);
        void dequeue(); // just dequeue the last car in the queue
        void dequeue(Car c); // if a certain car wants to go out of the queue midway. 
                             // Condition: Car is not in washing. Meaning is not the 1st item in the queue
        void dequeue(int index); // same as the previous comment
        Car getFront();
        void getCarQueue(Queue);
        int length();
        Car get(int);
    };

    Queue::Queue() {
        size = 0;
        front = 0;
        rear = Q_MAX_SIZE -1;
    }

    Queue::~Queue() { 
        while(!isEmpty()) {
            dequeue();
        }
    }

    void Queue::enqueue(Car c) {
        if (!isFull()) {
            rear = (rear + 1) % Q_MAX_SIZE; // circular array
            carQueue[rear] = c;
            size++;
        } else {
            cout << "Queue is currently full.\n";
        }
    }

    void Queue::dequeue() { 

    }

    void Queue::dequeue(int index) {
        if(!isEmpty()) {
            front = (front + 1) % Q_MAX_SIZE;
            if(front != index) {
                carQueue[index-1] = carQueue[index];
                rear--;
                size--;
            } else {
                cout << "Not allowed to dequeue the first car in the queue.\n";
            }
        } else {
            cout << "There are no cars to dequeue.\n";
        }
    }

    bool Queue::isEmpty() {
        return size == 0;   
    }

    bool Queue::isFull() {
        return (size == Q_MAX_SIZE);
    }

    Car Queue::getFront() {
        return carQueue[front];
    }

    int Queue::length() {
        return size;
    }

    Car Queue::get(int index) {
        return carQueue[index-1];
    }

    void Queue::getCarQueue(Queue q) {
        for(int i = 0; i< q.length(); i++) 
            cout << q.get(i) << endl;  // Error here
    }

    #endif

error C2679: binary ‘<<‘ : no operator found which takes a right-hand operand of type ‘Car’ (or there is no acceptable conversion)
I get this error which is kind of odd. so is there anything wrong? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:26:47+00:00Added an answer on June 17, 2026 at 9:26 am

    cout has no idea how to process a car object; it has never seen a car object and doesn’t know how you output a car as text. cout can only process types it knows about, string, char, int, etc. The specific error is because there is version of operator << that takes an ostream and a car.

    There are two options:

    1. Creation an overload for operator<< that takes an ostream and a car. That will show cout how to output a car. This isn’t usually done becuase there is usually more than one way your would want to display a car.
    2. Write the output statement so that it manually prints out car properties like
      cout << c.getMake() << " " << c.getModel()
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following class: #include <string> #include <stack> #include <queue> #include map.h using
I have created MutexCondition class like this /*MutexCondtion.h file*/ #ifndef MUTEXCONDITION_H_ #define MUTEXCONDITION_H_ #include
I have the following queue class (taken from wordpress): #include<iostream.h> class Queue { private:
I have written the following wrapper for std::bind and std::queue : #include Queue.h template<class
There is some class wComplex with == operator. #ifndef WCOMPLEX_H #define WCOMPLEX_H #include <stdio.h>
In my project I use the std::queue class. I would like to know what
I have built a variety of little scripts using Ruby's very simple Queue class,
I am using a thread-safe queue class and have a problem with the insert
In my int Queue::remove(int x) member function of my Queue class that you will
I've following queue class: class Queue { private Object[] data; private int numOfElements; private

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.