| | |
what this error mean ? Any 1 pleeese
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
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 :
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;
(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 :
C++ Syntax (Toggle Plain Text)
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' 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;
•
•
•
•
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.
and how i can solve this error ;
this is the struct :
struct Book{
address AD;
string name;
long phone;
};
•
•
•
•
OK ,thanks
and how i can solve this error ;
this is the struct :
struct Book{
address AD;
string name;
long phone;
};
struct Book{ address AD; ... };
what kind of data type address is?
•
•
•
•
Can you give information about
struct Book{ address AD; ... };
what kind of data type address is?
struct address{
long roadNo;
string roadname;
long homeNo;
};
•
•
•
•
address is onother struct :
struct address{
long roadNo;
string roadname;
long homeNo;
};
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
•
•
•
•
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
addrss first then Book
![]() |
Similar Threads
- Error Loading operating System (Windows NT / 2000 / XP)
- office 2000 install error (Windows NT / 2000 / XP)
- VMWare Unrecoverable Error (*nix Software)
- Error in Wrox Book (Perl)
Other Threads in the C++ Forum
- Previous Thread: Dynamic memory for an array of objects
- Next Thread: STL vector - deleting the last element
| Thread Tools | Search this Thread |
api array arrays based binary bitmap c++ c/c++ calculator char char* class classes code coding compile console conversion convert count data database delete deploy developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news node number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






