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

C++ Questions What would happen if the symbol used in the #ifndef/#define direct

ID: 3858585 • Letter: C

Question

C++ Questions

What would happen if the symbol used in the #ifndef/#define directives wasn't unique? If a library consisted entirely of inline functions (and/or constants and/or typedefinitions), would it need an implementation file? Why/Why not? For each of the following, indicate whether you could use inline-ing or default arguments (or both or neither). (It would be helpful if you explained what you felt would default...) i) function to generate random values in a specified range ii) function to return true if an event of a given probability has 'happened' iii) function to input a date from the user (mm/dd/yy) - adjusting for Y2K issues iv) function to calculate the area of a triangle v) function to print a specified number of copies of the current document to the specified printer

Explanation / Answer

i) default - in case of random values because user may / may not provide the range in which random values are required. say rand()%n where n should be sent for sure.

ii) inline - because the fucntion code may be small to be substituted during function call

iii) neither - not inline not default is required/useful

iv) inline & default both - because the fucntion code may be small to be substituted during function call as well as one of the arguments may not be sent where default values need to be set.

v) inline & default both - because the fucntion code may be small to be substituted during function call as well as one of the arguments may not be sent where default values need to be set.( by default we need to set no of copies as 1 ).

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote