0
Can anyone tell me what was bool for/function?
3 Respostas
+ 5
book (short for boolean) stores either true or false as its value. It's used to create flags, that say whether something has occurred or not.
The naming conventions for them usually follow the pattern of isX (Ex: isActive). Here's an example of how to use one:
//Linear search of an array
for (int i = 0; i <= ARR_SIZE; i++)
{
if (arr[i] == wantedVal)
{
isFound = true;
location = i;
break;
}
}
if (isFound)
cout << wantedVal << " found at position " << location << endl;
else
cout << wantedVal << " was not found..." << endl;
+ 2
bool means boolean it is data type to store true false
+ 1
thanks..but i still dony know how to use it correctly