Hi this is for my computer engineering class and its a practice exam from last s
ID: 3807137 • Letter: H
Question
Hi this is for my computer engineering class and its a practice exam from last semester we're supposed to use to study, but he didn't add the solutions. Please Help! If you could please explain how you acquired your answer that would be great!
CPE 112 Fall 2016 Exam III (100 pts) November 17, 2016 21. (5 pts) Consider the following structure declarations when answering the questions below. struct Date int day; int month; int year; struct Purchase string name Date buy Date a) Write a statement that declares the identifier payday as a variable of DataType Date. b) Write a output statement that will output the value of month of the variable payday. c) Write a statement that declares the identifier item as a variable of DataType Purchase. d rite a statement that assigns a value of "Car" to the name member of item e) Write an output statement that will output the value of year of the buyDate member of item. 22. (6 pts) Write a structure declaration for a structure named Zoo with the following members: an integer variable representing the number of animals a string variable representing the name of the zoo a string variable representing the city where the zoo is located a floating-point variable indicating the cost of admission oExplanation / Answer
21)
a) Struct Date payday;
b) cout << payday.month;
c) Struct Purchase item;
d) item.name = "Car";
e) cout << item.buyDate.year
22)
Struct Zoo
{
int noOfAnimals;
string name;
string city;
float costOfAdmission;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.