I am working on client/server project. i am struggling with how to find vector's information in database to match client's account number that requested.
header file
struct storeData
{
int iAccountNumber;
int iPin;
double dBalance;
string sFirstName;
string sLastName;
string sMiddleInitial;
};
vector <storeData> storeDataArray;
storeData dataObj;
in server file..
int MyThread::findAccountNumberInStore(int iAccountNumber)
{
int iIndex = -1;
for(int unsigned i = 0; i <= storeDataArray.size(); i++)
{
//i got error message in if statement. i dont know how to fix it.
if(iAccountNumber == storeDataArray.at(dataObj.iAccountNumber))
{
return i;
}
}
return iIndex; //no account is found...
}
Also how can I store the struct's data in vector (all data in one element)?