getting a c2679 error with this function.
[code=c++]
int arraySearch(const string& name,int& numNames,const string secArray[][1])
{
int index = 0;
bool found = false;
while((!found)&&(index < numNames))
{
if(secArray[index] == name) <---this is where the error is located
{
found = true;
}
else
{
index++;
}
}
if(found)
{
return index;
}
else
{
return - 1;
}
}
[/code]
Yeah... We haven't yet memorized the error codes of every compiler known to man. I happen to know that that's a VC++ error because it's a very common one, but (unsurprisingly) I don't know what it is. Next time, don't even bother posting the error code and just post the error message instead.
You're trying to compare a pointer (secArray is a pointer to an array of pointers IINM) to a string, which is of course wrong. Change the type of secArray from 'const string[][1]' to 'const string[]'. An array of size 1 is just silly.
im sorry im new to asking for advice online for my code errors ...heres the error message:
Error 4 error C2679: binary '==' : no operator found which takes a right-hand operand of type 'const std::string' (or there is no acceptable conversion) c:\users\homepc\desktop\q6_assignment1\q6_assignment1\q6_a1_code.cpp 311
thank you so much you just help me get out of a 6 hour problem.... but the reason why i was trying to use [][1] is because i was eventually going to check the next column along with the first (name & password) verification. thx you gave me enough progress....and one again sorry about that :)