Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
with tuple i have this code
for (std::vector<std::tuple<uint32, std::string, uint32> >::const_iterator ixn = messages.begin(); ixn != messages.end(); ++ixn)
{
if (std::get<0>(ixn) == user->getID() && std::get<1>(ixn) == msg && std::get<2>(itr) > time)
{
//some doin
}
}
and it sayin
no matching function for call to ‘get(std::vector<std::tuple<long unsigned...
You need to dereference your iterator using (*ixn). Also your last iterator is called itr instead of ixn.
for (std::vector<std::tuple<uint32, std::string, uint32> >::const_iterator ixn = messages.begin(); ixn != messages.end(); ++ixn)
{
if (std::get<0>(*ixn) == user->getID() && std::get<1>(*ixn) == msg && std::get<2>(*ixn) > time)
{
//some doin
}
}
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I don't know if I'm just being stupid, but Visual Studio says that my for loop is only executing once, and it does seem to be the case. However I can't figure out why. I'd really appreciate it if anyone could tell me what I'm doing wrong.
for (int i = (nbToVerify - 1); i == 1; i--)
{
if (nbToVerify % i == 0)
{
nbIsPrime = false;
break;
}
else
{
nbIsPrime = true;
}
}
Thanks!
i == 1 should be i != 1, that's it.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
i am having an issue with this code so all the tarif = x; is underlined when i run the program, but i don't see how i could solve this and exactly what is the error ? thank you for your help !
double saaq::Camion::tarificationAnnuelle() const
{
double tarif;
if(m_nbEssieux == 2 && m_poids >= 3001 && m_poids <= 4000)
{
tarif = 570,28;
}
if(m_nbEssieux == 2 && m_poids >= 4001)
{
tarif = 905,28;
}
if(m_nbEssieux == 4)
{
tarif = 2206,19;
}
if(m_nbEssieux == 5)
{
tarif = 2821,76;
}
if(m_nbEssieux >= 6)
{
tarif = 3729,76;
}
return tarif;
}
It's an obvious typo when you write double constant:
tarif = 570,28;
should be
tarif = 570.28;
that applies to all other double assignments..
Also you should initialise your tarif variable,
double tarif = 0;
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
I have number lying in a string variable.
I wanna check if every one of its elements is equal to some value, so I use the for loop to loop over every element and use if:
int zera = 0, jedynki = 0;
for (int i = 0; i < liczba.length(); i++) {
if (liczba[i] == 0) zera ++;
else if (liczba[i] == 1) jedynki ++;
}
liczba is a string.
I know now that I can't do that. I tried to convert this int into char but still, nothing happened.
What's wrong here? What should I do?
you're comparing int with char
should be:
if (liczba[i] == '0') {}
else if (liczba[i] == '1') {}
should be used:
if (liczba[i] == '0')
or using atoi:
if (atoi(liczba[i]) == 0)
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
Sorry if this is very basic question. I'm a Java guy and new to CPP. As per logic everything looks fine to me. But the compiler still throwing the error
"result was not declared in this scope " What might be the reason ?
And line causing error is
ns1__changePinTestResponse* result= soap_new_ns1__ChangePinResponse(this);
Here are my codes.
int ATLServerService::changePinTest(_ns1__changePinTest *ns1__changePinTest, _ns1__changePinTestResponse *ns1__changePinTestResponse)
{
LOG_DEBUG_MSG("ATLServerService::changePassword()");
char* accountID = (char*)ns1__changePinTest->accountID.c_str();
int accountPin = ns1__changePinTest->accountPin;
char* newPassword = (char*)ns1__changePinTest->newPassword.c_str();
char* yourSerialNumber = (char*)ns1__changePinTest->yourSerialNumber.c_str();
tfaddress transactionFileAddress;
int returnValue = 0;
returnValue = Account::changePassword(toteGateway, myGdi,accountID, accountPin,
newPassword, yourSerialNumber, &transactionFileAddress);
ns1__changePinTestResponse* result= soap_new_ns1__ChangePinResponse(this);
result->code = returnValue;
if (returnValue == ESUCCESS) {
result->message = &SUCCESS;
result->transactionFileAddress = transactionFileAddress;
} else {
result->message = &ERROR;
}
ns1__changePinTestResponse->changePinTestReturn= result;
return SOAP_OK;
}
You are missing the first underscore. It should be:
_ns1__changePinTestResponse
not
ns1__changePinTestResponse
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
this is my height function in bst. cpp
int IntBinaryTree::getHeight(TreeNode * nodePtr)
{
if(nodePtr = NULL)
return 0;
else
return (max(1+getHeight(nodePtr->left), 1+getHeight(nodePtr->right)));
}
When I call it in main(). I got an error.
this is my main()
int main {
IntBinaryTree tree;
....
tree. getHeight();
return 0;
}
You didn't say what error, but looks like changing:
if(nodePtr = NULL)
to
if(nodePtr == NULL)
^^
is what you need.