what this error mean ? Any 1 pleeese

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2007
Posts: 85
Reputation: Zay is an unknown quantity at this point 
Solved Threads: 0
Zay's Avatar
Zay Zay is offline Offline
Junior Poster in Training

what this error mean ? Any 1 pleeese

 
0
  #1
May 3rd, 2007
its about Data Structure

(in doubly link List )

this is my function
bool search( T item)
{
nodetype <T> *cur;
bool found;
cur=first;
while(cur!=NULL && !found)
{
if((cur->info).name==item)
return true;
else
cur=cur->next;
}

return found;
}


and this is the error :

  1. error C2664: 'search' : cannot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' to 'struct Book'
  2. No constructor could take the source type, or constructor overload resolution was ambiguous


this the call from main :
case 3:
cout<<"Please Enter person's name to search :";
cin>>name2;
cout<<"\n";
found=L1.search(name2);
if(found==false)
cout<<"Not found\n";
else
L1.display(name2);
break;
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,616
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 466
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: what this error mean ? Any 1 pleeese

 
0
  #2
May 3rd, 2007
Your search function takes an item of type T (which is a structure named Book by the looks of it) and you are trying to pass a string variable to it.
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 85
Reputation: Zay is an unknown quantity at this point 
Solved Threads: 0
Zay's Avatar
Zay Zay is offline Offline
Junior Poster in Training

Re: what this error mean ? Any 1 pleeese

 
0
  #3
May 3rd, 2007
Originally Posted by ~s.o.s~ View Post
Your search function takes an item of type T (which is a structure named Book by the looks of it) and you are trying to pass a string variable to it.
OK ,thanks

and how i can solve this error ;
this is the struct :

struct Book{
address AD;
string name;
long phone;
};



Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 29
Reputation: fulyaoner is an unknown quantity at this point 
Solved Threads: 2
fulyaoner's Avatar
fulyaoner fulyaoner is offline Offline
Light Poster

Re: what this error mean ? Any 1 pleeese

 
0
  #4
May 3rd, 2007
Originally Posted by Zay View Post
OK ,thanks

and how i can solve this error ;
this is the struct :

struct Book{
address AD;
string name;
long phone;
};

Can you give information about
struct Book{
address AD;
...
 
};

what kind of data type address is?
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 85
Reputation: Zay is an unknown quantity at this point 
Solved Threads: 0
Zay's Avatar
Zay Zay is offline Offline
Junior Poster in Training

Re: what this error mean ? Any 1 pleeese

 
0
  #5
May 3rd, 2007
Originally Posted by fulyaoner View Post
Can you give information about
struct Book{
address AD;
...
 
};

what kind of data type address is?
address is onother struct :

struct address{
long roadNo;
string roadname;
long homeNo;
};
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 29
Reputation: fulyaoner is an unknown quantity at this point 
Solved Threads: 2
fulyaoner's Avatar
fulyaoner fulyaoner is offline Offline
Light Poster

Re: what this error mean ? Any 1 pleeese

 
0
  #6
May 3rd, 2007
Originally Posted by Zay View Post
address is onother struct :

struct address{
long roadNo;
string roadname;
long homeNo;
};
may be you try to use address structure before you define it.

as the compiler goes one way : from up to down, no turn back.
so I think you first defined the the Book struct, then defined the address struct.
try moving the address struct before the Book struct.

But, if there is any other error causing that issue, I don't have anything to say
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 85
Reputation: Zay is an unknown quantity at this point 
Solved Threads: 0
Zay's Avatar
Zay Zay is offline Offline
Junior Poster in Training

Re: what this error mean ? Any 1 pleeese

 
0
  #7
May 3rd, 2007
Originally Posted by fulyaoner View Post
may be you try to use address structure before you define it.

as the compiler goes one way : from up to down, no turn back.
so I think you first defined the the Book struct, then defined the address struct.
try moving the address struct before the Book struct.

But, if there is any other error causing that issue, I don't have anything to say
they are in order,

addrss first then Book
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC