[Solved]Know M Right Path Don T Know Continue C Assignment Job Write Display Calendar Given Month Q37255170
I know I’m on the right path, but don’t know where to continuefrom here. This is a C++ assignment
Your job is to write that will display a calendar for any givenmonth of a given year. The user will need to type the number of themonth as an integer from 1 to 12 (1 is for January, etc.), and theyear as a 4-digit integer. This assignment simply requires thatyour program make use of more than one loop statements and as manyfunctions as possible to breakdown the problem into simplersub-problems. Also, you must have at least one valued function andone void function. In addition, your program should keep thecalendar neatly tabulated.
#include <iostream>
#include <string>
#include <stdio.h>
#include <math.h>
#include <iomanip>
#include <sstream>
using namespace std;
void grabTheDValues(int &m, int &y, int¢ury, int month, int year);
int DGrabbed(int m, int y, int century, int d);
bool leapYearIf(int y);
int leapYear(int y);
int daysInMonth(int m, int y);
void printCa1endarHead(int m);
void skipws(int i);
string monthName(int month);
void skipDay(int dy);
void displayMonth(int numOfDays, int dOfWeek);
int main() {
int month = 0;
int year = 0;
int m = 0, y = 0, century = 0, d = 0;
int itsTheFirstOfTheMonth;
int numOfDays;
itsTheFirstOfTheMonth = DGrabbed(m, y,century, d);
cout << “Enter a month as an integer(3 for March … 12 for December, 13 for January, 14 for February,etc.): “;
cin >> month;
cout << “Enter a year as a four digit integer:”;
cin >> year;
grabTheDValues(m, y, century, month,year);
if (month >= 3 && month <= 14) {
numOfDays = dayInMonth(m);
printCa1endarHead(m);
displayMonth(numOfDays,itsTheFirstOfTheMonth);
cout << endl <<endl;
}
cout << setw(15) << DGrabbed <<endl;
system(“pause”);
return 0;
}
void grabTheDValues(int &m, int &y, int¢ury, int month, int year) {
m = month;
century = (year – y) / 100;
y = year – 100 * century;
}
int DGrabbed(int m, int y, int century, int d) {
d = ((26 * (m + 1) / 10) + y + (y / 4) + (century / 4)+ (5 * century)) % 7;
return d;
}
bool leapYearIf(int y) {
return(y % 400 == 0) || (y % 4 == 0) && (y %100 == 0);
}
int leapYear(int y) {
return (y/4) – (y/100) + (y/400);
}
string monthName(int month) {
string nameOfMonth[] = { “January”, “February”,”March”, “April”, “May”, “June”,
“July”, “August”, “September”,”Octoher”, “November”, “December” };
return (nameOfMonth[month]);
}
int daysInMonth(int m, int y) {
if (m == 14) {
if (y % 400 == 0 || y % 4 == 0&& y % 100 != 0)
return(29);
else
return(28);
}
else if (m == 3 || m = 5 || m == 7 || m == 8 || m ==10 || m == 12){
return (31);
}
else{
return(30);
}
}
void printCa1endarHead(int m) {
if (m == 13) {
skipws(7);
cout << “January” <<endl;
}
else if (m == 14) {
skipws(7);
cout <<“February” << endl;
}
else if (m == 3) {
skipws(7);
cout << “March” <<endl;
}
else if (m == 4) {
skipws(7);
cout << “April” <<endl;
}
else if (m == 5) {
skipws(7);
cout << “May” <<endl;
}
else if (m == 6) {
skipws(7);
cout << “June” <<endl;
}
else if (m == 7) {
skipws(7);
cout << “July” <<endl;
}
else if (m == 8) {
skipws(7);
cout << “August” <<endl;
}
else if (m == 9) {
skipws(7);
cout << “September” <<endl;
}
else if (m == 10) {
skipws(7);
cout << “October” <<endl;
}
else if (m == 11) {
skipws(7);
cout << “November” <<endl;
}
else if (m == 12) {
skipws(7);
cout << “December” <<endl;
}
cout << “SuntMontTutWedtThtFritSat”<< endl;
cout << “——————————-“;
}
void skipws(int i) {
while (i > 0) {
cout ” “;
i = i – 1;
}
}
void displayMonth(int numOfDays, int dOfWeek) {
int day = 1;
skipDay(dOfWeek);
while (day <= numOfDays) {
cout << setw(2) << day<< ” “;
if (dOfWeek == 6) {
cout <<endl;
dOfWeek =0;
}
else {
dOfWeek =dOfWeek + 1;
day = day +1;
}
}
}
void skipDay(int dy) {
return skipDay(3 * dy);
}
Expert Answer
Answer to I know I’m on the right path, but don’t know where to continue from here. This is a C++ assignment Your job is to write … . . .
OR

