Assert not working correctly?

I have to include an assert for a credit card program, that makes sre the length is between 13-16. Is this correct formatting? Because I enter valid lengths and it returns "invalid length". Thanks

1
2
3
4
5
6
7
bool checkLength(string creditCardNumber)
{
    int length;
        length=creditCardNumber.length();
        cout << "Length of credit card number is:" << " " << length << endl;
    assert(length>=13 && length<=16);
}
closed account (2wpSLyTq)
make sure you #include <assert.h>
I did include it. I didn't put my assert in the main though, it's under the length function, do you think that could be the problem?
closed account (2wpSLyTq)
no
This is what it says when I try to build:
"warning: control reaches end of non-void function" and it indicates the line where I put assert.
You forgot to return something from the function.
That was it, thanks.
closed account (2wpSLyTq)
if your functions isn't void, you need to return a value;
Topic archived. No new replies allowed.