Is this a function?

bool isValidPassword(string pass)
{
return pass.length()>=8;
}
Last edited on
Last edited on
Thank you!
Functions are explained in tutorial:
http://www.cplusplus.com/doc/tutorial/functions/

What makes you suspect that the code sample is/isn't a function?


Edit: A subset of functions is called predicates. Yours is a predicate function.
Last edited on
Sure, why do you ask?
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
#include <string>
using namespace std;

bool isValidPassword(string pass)
{
return pass.length()>=8;
}

int main()
{
    cout << boolalpha << isValidPassword( "cplusplus.com" ) << "   " << isValidPassword( "c++" ) << '\n';
}
Topic archived. No new replies allowed.