Numerology prog help - beginner

Hey I did some c++ back in high school and I just started getting back into coding as a cure for boredom. I saw a tombstone at a local graveyard and realized the husbands birthday added up to 44, the wife’s birthday added up to 43, the husbands death date added up to 42, and I thought it would be neat if the wife (still alive) ended up dying on a date that totaled 41. So I made this makeshift program to see all the possible dates that might be in the next 18 years (she would then be 100). I used arrays to store the possible dates but I believe I’m having trouble using a variable to identify the element I’d like to assign it to. Just a beginner so I hope this is a. Simple fix. Please help 😊


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

Last edited on
Please edit for code tags -> http://www.cplusplus.com/articles/jEywvCM9/
Oh dear. I do hope Mrs. Oakland doesn't realize that you are making a program trivializing the death of her husband, lol. Anyway, we are going to need more specifics in order to help you with your problem. Which part of the code do you have a question on and what don't you understand about it?
I made a little program to "add up" the dates by summing the digits in the month, day, and year. Starting from 1 / 1 / 2019, the first date that sums to 41 is 9 / 29 / 2199
Last edited on
Registered users can post here. Sign in or register to post.