HI

First I apologiz
‎ about my bad language
Be cuz my language is not English

I have this problem in my project code
And I try to solve it but I cannot

This is in the part of main

int main ()
{	
	 
	Queue<primaryPatient> primaryQueue;//create object from class Queue with 
	                                   //data type primaryPatient
	PriorityQueue<patient,int> pq;//create object from class priority Queue with 
	                              //data type pateint and type key int
	AvlTree<Doctor,int> tree; 
	patient* rooms[5];
	                 
	for (int i=0; i<5 ; i++)
	    rooms[i] = NULL;

And this is where the problem exists

void check (patient *rooms[5],PriorityQueue<patient,int> pq,AvlTree<Doctor,int> &tree)
{
	patient p;
	Doctor d;
	bool flag = true;
	while (!pq.emptyQueue() && flag)
	{
		pq.dequeue(p);
		for (int i=0; i<5; i++)
		  {
		  	if (rooms[i]==NULL )
		  	  {
		  	  	rooms[i] = &p;
		  	  	callDoctor(tree,i);
		  	  	i = 5;
		  	  }
		  	else
		  	  {
		  	  	if (i == 4)
		  	  	   cout<<"\nthere is no room available..";
		  	  	   pq.enqueue(p);
		  	  	   flag = false;
		  	  }
		  }   
	}
	if (flag)
	   cout<<"\nthere is no patient need to be treated";
}

this is print scren of the problem
http://up4.m5zn.com/photos/00080/KNNMJ90Z1Y7S.jpg

and this is the prob
error. no match for 'operator==' n+c++


ifind ur forums helpfull
and i hope i finde help

It could be quite a number of things. I'll need to see a lot more of your code.

You haven't been overloading the == operator in funny ways or anything?

here's your problem...

if (rooms[i]==NULL )
		  	  {
		  	  	rooms[i] = &p;
		  	  	callDoctor(tree,i);
		  	  	[b]i = 5;[/b]
		  	  }

you just set index i=5... your array only has 5 elements, 0-4.

so when you try to access room[5], it craps out on you.


.

It could be quite a number of things. I'll need to see a lot more of your code.

You haven't been overloading the == operator in funny ways or anything?

can I send all my project to u?

no I did not overloading any thing

i think the problem something about array and how i resaved it an
parameter or something like this

here's your problem...

if (rooms[i]==NULL )
		  	  {
		  	  	rooms[i] = &p;
		  	  	callDoctor(tree,i);
		  	  	[b]i = 5;[/b]
		  	  }

you just set index i=5... your array only has 5 elements, 0-4.

so when you try to access room[5], it craps out on you.


.

i try ur solution but its didnt work

It wasn't the problem but it is a problem.

No, you can't send your project to me. My mailbox is clogged and I just don't care that much. (Sorry)

The compiler is complaining because there is something wrong with the type of rooms[[B][I]n[/I][/B]].

In C++, the == operator typically requires a const reference to a known or unambiguously promotable type.

Make sure that the type of rooms doesn't change and is explicitly declared in all scopes. Also check that you haven't included some header that has messed around with the definition of NULL.

If you are using the GCC, make sure you are compiling with g++ and not gcc.

Good luck.

This article has been dead for over six months. Start a new discussion instead.