#include <stdio.h>
// create a struct to store users information
struct user
{
int ID;
char Username[50];
char DateBirth[50];
char Class[10];
};
int InputUser(){
int n;
int Date;
int Month;
int Year;
user u;
printf("\nName:");
gets(u.Username);
printf("\nID: ");
scanf("%d",&u.ID);
printf("\nClass: ");
gets(u.Class);
printf("\nDate: ");
scanf("%d",&Date);
printf("\nMonth: ");
scanf("%d",&Month);
printf("\nYear: ");
scanf("%d",&Year);
return 0;
}
I want to input Date of Birth from users into struct char DateBirth[10];
and it will display DD/MM/YYYY. Example: 19/04/2023.
How can I create a code for Date of Birth ?
My code is above.