I have a code, and this is another problem, that's not working;
Given:
an int variable k ,
an int array currentMembers that has been declared and initialized,
an int variable nMembers that contains the number of elements in the array,
an int variable memberID that has been initialized, and
a bool variable isAMember ,
Write code that assigns true to isAMember if the value of memberID can be found in currentMembers , and that assigns false to isAMember otherwise.
Use only k , currentMembers , nMembers , and isAMember .
my code:
main() {
int currentMembers[]={1,2,3},nMembers=3,k,memberID=2;
bool isAMember;
do
{
if (memberID == currentMembers[nMembers]){
isAMember = 1;
}
}while (memberID != currentMembers[nMembers]);
}