Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write this script in c++ language 27) (12 pts) Finish the program below by addin

ID: 3595651 • Letter: W

Question


Write this script in c++ language

27) (12 pts) Finish the program below by adding a void function as specified below. Add only a function prototype, function call statement and function definition to the following program. The name of the void function is InitStruct The function has one parameter of the struct Data Type Date. The function is to initialize the structure parameter with a date of November 24, 2016. The information stored in the structure must be available in main0 after the function call. #include using namespace std struct Date string month: int day: int year // Place the function prototype below this line int main () Date turkey variable to hold the date of Thanksgiving /I Place the function call statement below this line return 0 // Place the function definition below this // This function initializes a structure variable // with the date November 24, 2016 linewrite the definition

Explanation / Answer

Here is the code for you:

#include <iostream>
using namespace std;

struct Date
{
    string month;
    int day;
    int year;
};
//Place the function prototype below this line.
void initStruct(Date&);

int main()
{
    Date turkey;   //variable to hold the date of Thanksgiving
    //Place the function call statement below this line.
    initStruct(turkey);
    //cout << turkey.month << endl;
    return 0;
}

//Place the function definition below this line - write the definition.
//This function initializes a structure variable
//with the date November 24, 2016.

void initStruct(Date &thanksgiving)
{
    thanksgiving.month = "November";
    thanksgiving.day = 24;
    thanksgiving.year = 2016;
}