### 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 😊

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151`` ``````#include #include #include #include #include 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