Assignment submitted by Rishita Mahajanstudent number Essay

/*

Assignment submitted by Rishita Mahajan.

student number: 100371864

Assignment completed on 4th june

Assignment updated on 5th of june.

Refference is taken from = Text books, internet and class ppt.

steps to make this program;

step 1: declaring the values of the things we are gonna be using in the program step by step.

step 2:using switch and giving values in cases for the months of the year 2019.

step 3: using string function to

*/

#include

#include

#include

using namespace std;

int theDaysOfYear(int);

int theDaysOfYear(int num)

{

int days = 0;

//

switch (num)

{/* firstly, write all the cases in which all the months have 31 days,

like january, march, may, july, august, october, december.

Represented by the the serial number in which order they occur.*/

case 1:

case 3:

case 5:

case 7:

case 8:

case 10:

case 12:

days = 31;

break;

/*Now, write all the months of the year 2019 who have 30 days which are:

april, june, september, november. Again represented by their serial number order in which they occur.

*/

case 4:

case 6:

case 9:

case 11:

days = 30;

break;

/*lastly, enter the month which has neither 30 days nor 31 and that month is 2nd month of the year: Feburary.

*/

case 2:

days = 28;

break;

}

return days;

}

int main()

{// using string functions to use the month and col in a way to use in reneendar

string months[]=

{

“January”, “February”, “March”, “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November”, “December”

};

int row = 0, col = 1, rene[6][7] = {0};

int beginning = 1;

int days, thisYear = 2019;

string putTheMonthValue;

int monthOfYear;

cout > putTheMonthValue;

/*using if, else and else if function to define the values like which thing to use when we are given certain values. like if user enter month 1st then it

will show the first month of the year if not first month then it will show other else if values as according to the user value have been put in their.

*/

if(putTheMonthValue == months[0])

{//for first month: January

monthOfYear = 1;

}

else if (putTheMonthValue == months[1])

{ // for second month: Feburary

monthOfYear = 2;

}

else if (putTheMonthValue == months[2])

{ // for third month: March

monthOfYear = 3;

}

else if (putTheMonthValue == months[3])

{ //Fourth month: April

monthOfYear = 4;

}

else if (putTheMonthValue == months[4])

{ //Fifth month: May

monthOfYear = 5;

}

else if (putTheMonthValue == months[5])

{ // Sixth month: June

monthOfYear = 6;

}

else if (putTheMonthValue == months[6])

{ // Seventh month: July

monthOfYear = 7;

}

else if (putTheMonthValue == months[7])

{ // Eighth month: August

monthOfYear = 8;

}

else if (putTheMonthValue == months[8])

{ // Ninth month: September

monthOfYear = 9;

}

else if (putTheMonthValue == months[9])

{ //tenth month : october

monthOfYear = 10;

}

else if (putTheMonthValue == months[10])

{ //eleventh month: November

monthOfYear = 11;

}

else if (putTheMonthValue == months[11])

{ //Twelth month: December

monthOfYear = 12;

}

//The values of month are in integer form so we are using int monthOfYear and int monthNew and here values of monthOfYear is monthOfYear and we have to put monthNew value as 0.

int onthOfYear = monthOfYear;

int monthNew = 0;

//here we are using while loop function. Add number of days to the beginning and divide by 7 to get the exact answer we want to

cout

Still stressed from student homework?
Get quality assistance from academic writers!