This is the final homework assignment for a class I'm in. I'm not asking for answers, really, just something to get me pointed in the right direction (I don't want to cheat myself out of learning).
I need to create a calendar using a 2 dimensional array along with a parallel array to output a calendar based on user input.
- Declare month to be an array of type int of the proper size and dimensions (weeks and days), and initialize all elements to 0.
- Handle user input as follows: a. Ask the user for the month name, and match it to the appropriate number of days (hint: use parallel arrays) b. If the month is February, you need to know the year, and test if it is a leap year to adjust February’s number of days, if needed. c. Ask the user which day of the week the month starts on, and match it to the proper day number (Sunday being day 1), to determine which position in the two-dimensional array to start storing dates (hint: use parallel arrays)
- Use formatted output to display the month left-aligned, omitting “0” dates (see the output example below)
- Use functions if desired. Allow your main program to loop, allowing the user to ask for an unlimited number of months. Blockquote
I am not sure how to even really begin to start this. What should my array look like? Do I need to create a function for every month? How would I load the data into the array based on the user input? This is all I have right now:
int main(){
int month[6][7],rows,col;
string days[7] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
int year;
string userInput = " ";
cout << "Enter a month: ";
for (int r = 0; col < 5; r++)
{
}
}
Keep in mind this is low level C++ programming, so advanced concepts haven't really been introduced yet.
I appreciate any help you guys offer, thanks!