Lexical analyzer implementation in c++

How to implement dfa for identifier,number and space in c++?

A compiler does not immediately convert a high-level language into binary – it takes time to complete! During the compilation process, the first step that is undertaken is called lexical analysis.
Here is a C++ code for lexical analyzer.
What does a lexical analyzer do? Separation of a program into its tokens and classification of the tokens is the main responsibility of the lexical analyzer.