0

I want to make the user enter a date (3 numbers), but if he enters any letter he has to re-enter the date, I have this code but it doesn't work, what should I do?enter image description here

  • 1
    Use `fgets()` to read a line of input. Use `sscanf()` to parse it, and check the return value to see if all 3 numbers parsed correctly. – Barmar Oct 24 '22 at 19:20
  • increase `res` variable by `res++` – Ace Oct 24 '22 at 19:20
  • Welcome to Stack Overflow! Please post code, data, and results as text, not screenshots. http://idownvotedbecau.se/imageofcode – Barmar Oct 24 '22 at 19:20
  • 1
    @YAN `res` is to check that all three fields were correctly scanned. It's not some kind of time-out attempts. – Weather Vane Oct 24 '22 at 19:23

0 Answers0