恋爱计时器
#include <stdio.h>
#include <stdlib.h>
struct date
{
int year;
int mouth;
int day;
};
int main()
{
int dayst(struct date a, struct date b);
int xingqi(struct date a, int z);
struct date a, b;
int x, y;
printf(" ");
scanf_s("%d %d %d", &a.year, &a.mouth, &a.day);
printf(" ");
scanf_s("%d %d %d", &b.year, &b.mouth, &b.day);
x = dayst(a, b);
printf(" 今天是我们相爱的%d天\n 老婆我爱你!\n I love you!\n", x);
printf(" ****** *** *** ** ** \n");
printf(" ** ***** ***** ** ** \n");
printf(" ** ************* ** ** \n");
printf(" ** *********** ** ** \n");
printf(" ** ********* ** ** \n");
printf(" ** ******* ** ** \n");
printf(" ** ***** ** ** \n");
printf(" ** *** ** ** \n");
printf(" ****** * ****** \n");
printf("\n\n");
printf(" ********* * * ********* *** * *** * * ***** * * *** * * ***\n");
printf(" * * * * * * * * * * * * * * * ***\n");
printf(" * ********* ******** * * * * * * ***** * * * * * ***\n");
printf(" * * * * * * * * * * * * * * ***\n");
printf(" ********* * * * *** ** *** * ***** * *** ****** *\n\n");
system("pause");
system("pause");
return 0;
}
int dayst(struct date a, struct date b)
{
int i, j, x = 0, y = 0, day=0, d[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 }, c[12] = { 31,29,31,30,31,30,31,31,30,31,30,31 };
if ((a.year % 4 == 0 && a.year % 100 != 0) || a.year % 400 == 0)
for (i = 0; i<a.mouth - 1; i++)
x = x + c[i];
else
for (i = 0; i<a.mouth - 1; i++)
x = x + d[i];
x = x + a.day;
if ((b.year % 4 == 0 && b.year % 100 != 0) || b.year % 400 == 0)
for (i = 0; i<b.mouth - 1; i++)
y = y + c[i];
else
for (i = 0; i<b.mouth - 1; i++)
y = y + d[i];
y = y + b.day;
if (a.year == b.year) day = y - x;
else
{
if ((a.year % 4 == 0 && a.year % 100 != 0) || a.year % 400 == 0)
day = 366 - x + 1;
else
day = 365 - x + 1;
for (i = a.year + 1; i < b.year; i++)
if (( i % 4 == 0 && i % 100 != 0) || i % 400 == 0)
day = 366 + day;
else
day = 365 + day;
day = day + y;
}
return day;
}
#include <stdlib.h>
struct date
{
int year;
int mouth;
int day;
};
int main()
{
int dayst(struct date a, struct date b);
int xingqi(struct date a, int z);
struct date a, b;
int x, y;
printf(" ");
scanf_s("%d %d %d", &a.year, &a.mouth, &a.day);
printf(" ");
scanf_s("%d %d %d", &b.year, &b.mouth, &b.day);
x = dayst(a, b);
printf(" 今天是我们相爱的%d天\n 老婆我爱你!\n I love you!\n", x);
printf(" ****** *** *** ** ** \n");
printf(" ** ***** ***** ** ** \n");
printf(" ** ************* ** ** \n");
printf(" ** *********** ** ** \n");
printf(" ** ********* ** ** \n");
printf(" ** ******* ** ** \n");
printf(" ** ***** ** ** \n");
printf(" ** *** ** ** \n");
printf(" ****** * ****** \n");
printf("\n\n");
printf(" ********* * * ********* *** * *** * * ***** * * *** * * ***\n");
printf(" * * * * * * * * * * * * * * * ***\n");
printf(" * ********* ******** * * * * * * ***** * * * * * ***\n");
printf(" * * * * * * * * * * * * * * ***\n");
printf(" ********* * * * *** ** *** * ***** * *** ****** *\n\n");
system("pause");
system("pause");
return 0;
}
int dayst(struct date a, struct date b)
{
int i, j, x = 0, y = 0, day=0, d[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 }, c[12] = { 31,29,31,30,31,30,31,31,30,31,30,31 };
if ((a.year % 4 == 0 && a.year % 100 != 0) || a.year % 400 == 0)
for (i = 0; i<a.mouth - 1; i++)
x = x + c[i];
else
for (i = 0; i<a.mouth - 1; i++)
x = x + d[i];
x = x + a.day;
if ((b.year % 4 == 0 && b.year % 100 != 0) || b.year % 400 == 0)
for (i = 0; i<b.mouth - 1; i++)
y = y + c[i];
else
for (i = 0; i<b.mouth - 1; i++)
y = y + d[i];
y = y + b.day;
if (a.year == b.year) day = y - x;
else
{
if ((a.year % 4 == 0 && a.year % 100 != 0) || a.year % 400 == 0)
day = 366 - x + 1;
else
day = 365 - x + 1;
for (i = a.year + 1; i < b.year; i++)
if (( i % 4 == 0 && i % 100 != 0) || i % 400 == 0)
day = 366 + day;
else
day = 365 + day;
day = day + y;
}
return day;
}
#include <stdio.h>
#include <stdlib.h>
struct date
{
int year;
int mouth;
int day;
};
int main()
{
int dayst(struct date a, struct date b);
int xingqi(struct date a, int z);
struct date a, b;
int x, y;
printf(" ");
scanf_s("%d %d %d", &a.year, &a.mouth, &a.day);
printf(" ");
scanf_s("%d %d %d", &b.year, &b.mouth, &b.day);
x = dayst(a, b);
printf(" 今天是我们相爱的%d天\n 老婆我爱你!\n I love you!\n", x);
printf(" ****** *** *** ** ** \n");
printf(" ** ***** ***** ** ** \n");
printf(" ** ************* ** ** \n");
printf(" ** *********** ** ** \n");
printf(" ** ********* ** ** \n");
printf(" ** ******* ** ** \n");
printf(" ** ***** ** ** \n");
printf(" ** *** ** ** \n");
printf(" ****** * ****** \n");
printf("\n\n");
printf(" ********* * * ********* *** * *** * * ***** * * *** * * ***\n");
printf(" * * * * * * * * * * * * * * * ***\n");
printf(" * ********* ******** * * * * * * ***** * * * * * ***\n");
printf(" * * * * * * * * * * * * * * ***\n");
printf(" ********* * * * *** ** *** * ***** * *** ****** *\n\n");
system("pause");
system("pause");
return 0;
}
int dayst(struct date a, struct date b)
{
int i, j, x = 0, y = 0, day=0, d[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 }, c[12] = { 31,29,31,30,31,30,31,31,30,31,30,31 };
if ((a.year % 4 == 0 && a.year % 100 != 0) || a.year % 400 == 0)
for (i = 0; i<a.mouth - 1; i++)
x = x + c[i];
else
for (i = 0; i<a.mouth - 1; i++)
x = x + d[i];
x = x + a.day;
if ((b.year % 4 == 0 && b.year % 100 != 0) || b.year % 400 == 0)
for (i = 0; i<b.mouth - 1; i++)
y = y + c[i];
else
for (i = 0; i<b.mouth - 1; i++)
y = y + d[i];
y = y + b.day;
if (a.year == b.year) day = y - x;
else
{
if ((a.year % 4 == 0 && a.year % 100 != 0) || a.year % 400 == 0)
day = 366 - x + 1;
else
day = 365 - x + 1;
for (i = a.year + 1; i < b.year; i++)
if (( i % 4 == 0 && i % 100 != 0) || i % 400 == 0)
day = 366 + day;
else
day = 365 + day;
day = day + y;
}
return day;
}