2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by jencas
0

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.....

0
#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;
}

Edited by happygeek: fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.