Question: PLO-03 (30 marks) Q.2. Write C++ code for the following: a) Here's a function: int times2(inta) { return (a 2); 3 Write a main )

 PLO-03 (30 marks) Q.2. Write C++ code for the following: a)

PLO-03 (30 marks) Q.2. Write C++ code for the following: a) Here's a function: int times2(inta) { return (a 2); 3 Write a main ) program that includes everything necessary to call this function. b) Raising a number n to a power p is the same as multiplying n by itself p times. Write a function called power() that takes a double value for n and an int value for p, and returns and display the result as a double value. Write a main () function that gets values from the user to test this function. c) A phone number, such as 051 1212123, can be thought of as having two parts: the area code (051) and the number (1212123). Write a program that uses a structure to store these two parts of a phone number separately. Call the structure phone'. Create two structure variables of type "phone". Initialize one (suppose it has been initialized as 051 1111111. This is just for example, you can change it), and have the user input a number for the other one. Then display both numbers. HINT: The interface/communication might look like this: Enter your area code: 051 Enter your number: 042 45454545 The stored/initialized number is: 051 1111111 Your entered number is 042 45454545

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!