I need some code that checks the number of characters entered and if it is not seven it needs to display "Error not enough numbers"

i already tried (strlen(pin_code) == 7); but it says invalid conversion from int to const char...

It needs to not conflict with the checking of the pin number either...

int pin_num =1234567;
     do{
     cout << "Please enter your unique 7 digit pin code: ";
     cin >> pin_code;
     system("cls");
     }
     while(pin_code != pin_num);
          
     cout << "Code Accepted";
     Sleep(1000);
     system("cls");
     }

Thanks,
Adam

Why would you want to strlen() and integer? What is strlen() used for?

What is it that makes a 7 digit number different from, say, a 4 digit or 8 digit number?

But, if you are going to have a pin value ready for them to match, who cares if they enter 7 digits or not? If the pin doesn't match, it doesn't match.

Yeh thats what i thought, either way it still does the same thing, its just that its in the assignment that we have to tell the user if you havent entered in enough characters,

So my question stands:
What is it that makes a 7 digit number different from, say, a 4 digit or 8 digit number?

Answer that and you have a good idea what you need to test for. Think number, not digits.

its an odd number?

>> its an odd number?

And the reasoning behind this guess is...? If you can't fill in the dots, withdraw the guess.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.