1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
#include <stdlib.h>
#include <stdio.h>
#include <cmath>
#include <iostream>
#include <string>
using namespace std;
int addDates();
int num = 0;
int month = 1;
int day = 1;
int year = 2019;
int tickMonth = 0;
int tickDay = 0;
int tickYear = 0;
int tickYearInt = 0;
int yearNum[19] {12,4,5,6,7,8,9,10,11,12,13,5,6,7,8,9,10,11,12};
int month2[50] = {};
int day2[50] = {};
int year2[50] = {};
int a = 0;
int k = 0;
int main(){
addDates();
return 0;
}
int addDates()
{
while (a <= (year + 18))
{
while (month <= 12)
{
if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12)
{
while (day <= 31)
{
num = ((month + day) + (yearNum[tickYearInt]));
if (num == 41)
{
month2[tickMonth] = month;
day2[tickDay] = day;
year2[tickYear] = (year + tickYearInt);
tickMonth = tickMonth + 1;
tickDay = tickDay + 1;
tickYear = tickYear + 1;
}
num = 0;
day = day + 1;
}
}
if (month == 4 || month == 6 || month == 9 || month == 11)
{
while (day <= 30)
{
num = ((month + day) + (yearNum[tickYearInt]));
if (num == 41)
{
month2[tickMonth] = month;
day2[tickDay] = day;
year2[tickYear] = (year + tickYearInt);
tickMonth = tickMonth + 1;
tickDay = tickDay + 1;
tickYear = tickYear + 1;
}
num = 0;
day = day + 1;
}
}
if (a == 2020 || a == 2024 || a == 2028 || a == 2032 || a == 2036)
{
if (month == 2)
{
while (day <= 29)
{
num = ((month + day) + (yearNum[tickYearInt]));
if (num == 41)
{
month2[tickMonth] = month;
day2[tickDay] = day;
year2[tickYear] = (year + tickYearInt);
tickMonth = tickMonth + 1;
tickDay = tickDay + 1;
tickYear = tickYear + 1;
}
num = 0;
day = day + 1;
}
}
}
if (month == 2)
{
while (day <= 28)
{
num = ((month + day) + (yearNum[tickYearInt]));
if (num == 41)
{
month2[tickMonth] = month;
day2[tickDay] = day;
year2[tickYear] = (year + tickYearInt);
tickMonth = tickMonth + 1;
tickDay = tickDay + 1;
tickYear = tickYear + 1;
}
num = 0;
day = day + 1;
}
}
day = 1;
month = month + 1;
}
month = 1;
tickYearInt = tickYearInt + 1;
a = (year + tickYearInt);
}
cout << "Mrs. Oakland will probably die on one of these dates: " << endl;
while (k <= 50)
{
cout << month2[k] << ", " << day2[k] << ", " << year2[k] << endl;
k = k + 1;
}
return 0;
}
|