0

c issue

I have a question, for example, the user writes his birthday in this format "dd/mm/yyyy" I wanna extract dd as integer the same for mm and yyyy I found strtok+atoi but it doesn't satisfy my curiosity.in python it's a basic instruction though in C they make it harder

15th Mar 2019, 1:47 PM
ERRAZGOUNI SAAD
ERRAZGOUNI SAAD - avatar
1 Respuesta
+ 5
Use scanf(). int b_day = 0, b_month = 0, b_year = 0; puts("Enter your birthdate in the format dd/mm/yyyy:"); if(scanf("%d/%d/%d", &b_day, &b_month, &b_year) != 3) { fprintf(stderr, "Wrong format\n"); return 1; } Please remove the duplicate of this question
15th Mar 2019, 2:23 PM
Anna
Anna - avatar