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

Write a function which will read in a phone number from the user and \'return\'

ID: 3858106 • Letter: W

Question

Write a function which will read in a phone number from the user and 'return' it to the caller. The caller is expected to prompt the user before calling your function. Recall that a phone number is actually three values: an area code, an exchange, and a line number. These three values are normally typed with/'s and/or -'s between the numbers - you need not care which symbol(s) they choose. (No, they will not place the area code in parentheses! Yes, they will type ail three numeric parts and both separation symbols. No, they will not type a '1' in front - no matter what the phone Company says!) (Thought-provoker: Why should your function not prompt [literally] for the phone number?) (Thought-provoker 2: Could your function prompt and avoid the problem(s) this causes?) Place the following sections of a typical C/C++ application in order by numbering the blanks. (Thought-provoker: Where would inline functions go?) _____ using namespace directive _____ #include's for libraries _______ function definitions _______ main function _______ prototypes (& global const's/typedef's) The ______ arguments appear in the function's head. They may be passed to the function via either the _______ mechanism or the _______ mechanism. The latter will accept a copy of the ________ argument (the one listed in the function call). The former will instead form a direct link to the memory location of the caller's argument - thus allowing the function to change that memory even though the function doesn't own it (i.e. that memory location isn't for one of the function's (global/local) variables/constants). Default arguments must be placed at the (left/right) end of the argument list. The default value specification should only be placed on the (first/second/last) function head the compiler sees. Therefore, they are generally placed in the ______ of a regular function or on the _______ of an inline function. TRUE/FALSE AU methods of a class can access the private data of the class. TRUE/FALSE Data which is public is generally considered normal when defining a class. TRUE/FALSE private methods, although rare, can often be useful for tasks the class must (or should) manage on its own.

Explanation / Answer

13.) No they will not place the area code inside the parenthesis.

The reason behind this is simple because it is an input the program needs that number to forward it to the caller and hence, it can't be entered inside the parenthesis.The values inside the parenthesis are never read by the program and are only used for the displaying purposes.

14.) #include libraries

   use namespace directives

   function definitions

prototypes

main function

The above written order is the only order in which the programming is done and the practise of using such order is the best coding practice.

15.) parameterized , call by reference, call by value , parameterized

The parameterized arguments are been initialized in the functions head with the help of the call by reference or call by value they are called and moved from one function or method to different.

16.) right,last

for eg : Take the method below

int sum(int i, int w, int e=0, int q=0)

{

}

e,q are the default parameters and if the method goes like below it will generate an error because it has an default parameter stated and after that there is one more parameter.

int sum(int i, int w, int e=0, int t)

{

}

17.) i.) True. All the methods in the class can access the private data.This is the property of the private access modifier

ii.) True.

   iii.) True. All the class members are defaultly private and hence, it is very useful for the class to have private methods.

Please rate the answer if it helped....Thankyou

Hope it helps.....

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