Generating a 12-month Calendar for any entered year!

I have a program where I am to get the user input for any year, and generate a 12 month calendar from that. I will be using the Guassian Method:
w=(d+[2.6m-0.2]+y+[y/4]+[c/4]-2c)%7
where
y= last 2 digits of the year
c= first two digits of the year
d= day of month (1-30)
m= shifted month (March=1, Feb=12)

the main problem I'm having is after
cout << "Enter year: ";
cin>>year;

how do I get y and c from the entered year?
How do I get y and c from the entered year?


1
2
3
4
5
6
7
8
int year;
std::cin >> year;

char year_str[100];
itoa(year, year_str, 10);

int c = ((year_str[0] - '0') * 10) + (year_str[1] - '0');
int y = ((year_str[2] - '0') * 10) + (year_str[3] - '0');
Last edited on
Topic archived. No new replies allowed.