hi can any one send me the date validating program plz..........

i have done this but now i require to check the format dd/mm/yyyy and for leap yers also,some programs are there but i need the complete program can any one help.....

#include "stdafx.h"
#include <iostream.h>
#include <stdio.h>
#include <conio.h>


struct date
{
int day;
int month;
int year;
};


struct date today,tomorrow;


int main()
{
const int days_month[12] ={31,28,31,30,31,30,31,31,30,31,30,31};


printf("enter today's day,month and year\n");
scanf("%d%d%d",&today.day,&today.month,&today.year);
if (today.day != days_month[today.month-1])
{
tomorrow.day = today.day + 1;
tomorrow.month = today.month;
tomorrow.year = today.year;
}
else
{
tomorrow.day = 1;
tomorrow.month = today.month + 1;
tomorrow.year = today.year;
}


if ((today.month==12)&&(days_month[today.month-1] == today.day))
{
tomorrow.month=1;
tomorrow.year=today.year+1;
}
else
{
tomorrow.year=today.year;
}
printf("Today's date is %d/%d/%d\n", today.day, today.month,
today.year);
printf("Tomorrow's date is %d/%d/%d\n", tomorrow.day,
tomorrow.month, tomorrow.year);


getch();
return 0;
}
Member Avatar for jencas

Maybe this works for normal years, but not for leap years.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.