requiring date validating program

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2009
Posts: 3
Reputation: s_48 is an unknown quantity at this point 
Solved Threads: 0
s_48 s_48 is offline Offline
Newbie Poster

requiring date validating program

 
0
  #1
Sep 4th, 2009

hi can any one send me the date validating program plz..........
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 3
Reputation: s_48 is an unknown quantity at this point 
Solved Threads: 0
s_48 s_48 is offline Offline
Newbie Poster
 
0
  #2
Sep 4th, 2009
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.....
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 3
Reputation: s_48 is an unknown quantity at this point 
Solved Threads: 0
s_48 s_48 is offline Offline
Newbie Poster

Re: requiring date validating program

 
0
  #3
Sep 4th, 2009
#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;
}
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 360
Reputation: jencas is just really nice jencas is just really nice jencas is just really nice jencas is just really nice jencas is just really nice 
Solved Threads: 69
jencas jencas is offline Offline
Posting Whiz

Re: requiring date validating program

 
0
  #4
Sep 4th, 2009
Maybe this works for normal years, but not for leap years.
If you are forced to reinvent the wheel at least try to invent a better one!

Please use code tags - Please mark solved threads as solved
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC