Car license plate

I want to make a program, which first takes one license plate which is supposed to be mine and then three other license plates which are from others.
Now, the program should output, how many cars are more modern and how many are older. Obviously, vocals are not allowed...
I think creating an algorithm for this problem is easy. I just have to transform the chars into numbers so I can make a if method. But I don't certainly know how to make such thing. Maybe someone has an idea?
Perhaps if you described what exactly you wanted to in words, then someone can help you to translate that to code.
Is there some way to look at a car licence plate and know how old it is? Can you explain how?
@Repeater

I think the OP means if his license plate is 'BBM-7878' and one of the others is, say, 'BBN-6541', then that one comes after his plate, so would be newer, but a plate with 'BBL-8745', comes before his plate, so would be older.

This is my take on it.
Last edited on
Obviously, vocals are not allowed

I assume you mean "vowels".
But why is that "obvious"?
Vowels are allowed in our license plates.

Anyway, it seems that all you need to do is store them in std::string's and compare them in the usual way.
string.find/string.substr to find a substring of the license plate number
http://www.cplusplus.com/reference/string/string/find/
http://www.cplusplus.com/reference/string/string/substr/

std::stoi can convert strings to ints.
https://en.cppreference.com/w/cpp/string/basic_string/stol
If a license plate is more modern, at least in Spain, the numbers and letters have to increase.
The spanish plates have this format: int,int,int,int,letter,letter,letter. For example, 0001 BBB is older than 0001 BBC.
modern has nothing to do with it, its just a specific rule in your country.
ok, we can work with that.
have you tried just sorting them as strings? that looks like it would work, to me, in ascii at least. normal sort is old to new, reverse for newest on top, etc
Last edited on
Is there some way to look at a car licence plate and know how old it is?
Dents, scratches, rust, fading paint - ImageMan Retweeter is onto something.
Sounds like a job for OpenCV and some Deep Learning™.
There's also going to be an issue with custom license plates. It's also possible for people to get a license plate of their choosing while being a non-custom license plate - they can choose out of a list of random available license plate numbers available if they ask and the person is nice.


This program would be extremely easy if you had access to the database that police use to check license plate numbers!
It isn't just custom plates that can be an issue. In the US each state has a long history of changing serial formatting along with basic layouts such as color of lettering and background.

Here's wiki's rundown on vehicle registration plate history for my home state of Washington:
https://en.wikipedia.org/wiki/Vehicle_registration_plates_of_Washington_(state)

There are plates for passenger vehicles, different ones for non-passenger vehicles.

Countries other than the US likely have just as varied a system of changing plate looks.
Yea, in the U.S. in particular every state will have a different license plate numbering system and design. States can also change designs every now and then.
yabi2943993 wrote:
I just have to transform the chars into numbers so I can make a if method.
Without knowing anything about the format you are trying to decode makes it almost impossible for anyone to give you a hint of how to proceed.

If the format is mixed letters and numbers that would yield an algorithm that is entirely different and more complex than if the format is straight numbers. Just numbers would be almost insanely easy.
the program should output, how many cars are more modern and how many are older.

A licence plate number doesn't tell you anything about the age of a car.

A VIN - vehicle Identification number - does.

The link between the two is the registration information held by the registrar, or in some cases at least, on the registration label on the car.

Pursuing this problem by concentrating on the registration number any further is a pointless waste of time.

@yabi's absence in all of this is a good indicator that this is the case.
In Spain the license plates are related to the oldnes of a car
Or just ignore the example. I want to say, which number and char groups of a group(int,int,int,int,letter,letter,letter) are more advanced. Take this examples:
-1234 CCB >1233 CCB
-1234 CCC >1234 CCB
-1111 BTB >1111 BBT
-3333 YYY >3333 XZZ
Okay. Just compare the strings, which is already done lexicographically by default, as others already mentioned. What is the actual issue?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Example program
#include <iostream>
#include <string>

int main()
{
    std::string lic_A = "1234 CCB";
    std::string lic_B = "1233 CCB";
    if (lic_A > lic_B)
    {
        std::cout << lic_A << " is newer\n";
    }
    else
    {
        std::cout << lic_B << " is same age or newer\n";
    }
}
Last edited on
Ok now wrap this thread boring as batshit thread up yabi. There’s nothing more to drain out of this rubbish now that you have an answer and wasted 2 days of our time. Green tick.
Topic archived. No new replies allowed.