I need a c,c++ code for validating a Phone Number(8 Digits- Starting with 2) and Mobile Number(10 Digits- Starts with 9).
Also it should not allow to enter any space, special charcter, as well as charcters.
Here user can enter either phone number or mobile number.
Plese Help in this,
Thanks,
Here’s the code:
The function
is_valid_numbercould be improved to work on iterators instead of strings, or written as a functor on a single char and used with std::find_if to write the whole thing as a one-liner.