First of all, i apologize if this sort of question has already been asked and if i'm being a nuisance but i just don't know what to do.
Alright, so i've been trying to make a car number registration program. I will confess, this is my homework, and i don't expect solutions right away, just some tips and a general direction to what i should do.
It's basically like this:
if the number length is 5/6 where the first 2/3 letters are digits and the rest are letters, it's a valid code (for example "123ABC" or "12ABC") (Estonian car number).
And then there are specially manufactured car numbers with a length limit of 9. And it has to have at least 1 number. (for example "ABCDE12")
Everything else is undefined and are non-compliant with current car number rules etc.
I tried using isalpha, isnum conditionals but i just can't seem to tell the program that i want just the first particular digits etc.
I also tried doing it with for loops, but that didn't work so well.
Then i tried doing it with a while function, that didn't work so well either.
Here's an example of what i tried to do:
using namespace std;
const int j=3;
cout << "Please enter a car number";
if ( (i<carnum.length()) && (carnum.length()<=6) && (isdigit(carnum[i<=3])&&(isalpha(carnum[i>3]))))
printf("This car number is valid (Traditional car number)");
All and any help is appreciated