CPP
cpp
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
/*The moon today! And on your next Birthday!
Thanks for checking out my code, corrections welcome, please tell me anything that makes it more what Cplusplus good practice should be like!
Code with credits for what I have learned and borrowed to:
-MR Perfect for his code on how to integrate emojis in cplusplus: you need to use wide type, cannot mix cout and wcout
Since each lunation is approximately 29 1⁄2 days (29 days, 12 hours, 44 minutes, 3 seconds, or 29.530588 days), it is common for the months of a lunar calendar to alternate between 29 and 30 days. Since the period of twelve such lunations, a lunar year, is only 354 days, 8 hours, 48 minutes, 34 seconds (354.367056 days), purely lunar calendars lose around 11 days per year relative to the Gregorian calendar
🌍🌏🌕🌖🌗🌘🌑🌒🌓🌔🌚🌝🌛🌜🌞🌙
*/
#include <iostream>
#include <io.h>
#include <fcntl.h>
#include <ctime>
#include <string>
#include <iomanip>
using namespace std;
int main() {
_setmode(_fileno(stdout),_O_U16TEXT);
wcout << L"\xfeff"; //to use emojis in outputthe last two lines
float const selene=29.530588;
int const luna=59;
int YYYY=2019,DD=18,MM=5, day=10,i,j; //full moon on the 22nd Dec 2018, so days +10
int month[12]={31,28,31,30,31,30,31,31,30,31,30,31};
const wchar_t *st[8]={L"🌕",L"🌖",L"🌗",L"🌘",L"🌑",L"🌒",L"🌓",L"🌔" };
const wchar_t *si[4]={L"🌝",L"🌜",L"🌚",L"🌛"};
// non constant pointer to constant char array
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run