Major : TMD
Hello processor these code and video below are show you about how to create work date arithmetic program tomorrow :
#include <stdio.h>
#include <stdlib.h>
int main(){
struct days
{
int day;
int month;
int year;
};
struct days now,tomorrow;
int tdate[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
printf("Input value of day ");
scanf_s("%d",&now.day);
printf("\nInput value of month ");
scanf_s("%d",&now.month);
printf("\nInput value of year ");
scanf_s("%d",&now.year);
if(now.day<tdate[now.month-1])
{
tomorrow.day=now.day+1;
tomorrow.month=now.month;
tomorrow.year=now.year+1;
}
else if (now.month ==12)
{
tomorrow.day=1;
tomorrow.month=1;
tomorrow.year =now.year + 1;
}
else
{
tomorrow.day =1;
tomorrow.month = now.month + 1;
tomorrow.year = now.year;
}
printf("\n tomorrow is day %d month %d year %d \n", tomorrow.day,tomorrow.month,tomorrow.year);
system("pause");
}
This is my link :
http://www.youtube.com/watch?v=A-dOJmmsT9E&feature=youtu.be
No comments:
Post a Comment