In C programming, I am trying to force the user to enter a date in the format DD/MM/YYYY, and I want to make sure they input leading zeros if the day or month is less than 10. Is there any way to do this?
Thanks
![]() |
In C programming, I am trying to force the user to enter a date in the format DD/MM/YYYY, and I want to make sure they input leading zeros if the day or month is less than 10. Is there any way to do this?
Thanks
1 prompt them with the correct format
2 read their input
3 validate their input against the correct format
4 if their input is invalid give an error message and return to 1
If you dislike my answer please explain which portion you need more information on. You asked "Is there any way to do this?" and I wrote you pseudocode that would accomplish your task.
I assumed, based on the simplicity of your question, that it was probably a homework assignment of some form.
You gave me negative reputation but you wanted more info, my answer was not wrong.
We can continue to work on this question if you're still interested. You can post what code you have if you want or tell me which of my 4 steps you're having trouble with.
May I point the suggested guidelines for using the comments feature found here:
https://www.askmehelpdesk.com/feedba...ure-24951.html
You asked; "Is there any way to do this?" A valid answer would have been simply Yes. Not only did you get that answer, but you got the steps needed. If you wanted the actual code to do it, you should have asked for that. I think you owe Asterisk_man an apology.
All times are GMT -7. The time now is 06:58 AM. |