Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Do problem 18 in section 3.9 of the text. Put your function pos_power() in the file exponent.c and the prototype in the file exponent.h. Another

Do problem 18 in section 3.9 of the text. Put your function pos_power() in the file exponent.c and the prototype in the file exponent.h.

Another useful debugging technique is to put debug lines into your functions to show when it is called, with what values are passed to it, and when the function returns with what value is being returned. Try using this technique for your function pos_power(). Put a printf() that looks like:

 printf("debug:Enter pos_power: base = %f exponent= %d ", base, exponent); 

as the first statement executed in your function. Put a printf() that looks like:

 printf("debug:Exit pos_power: result = %f ", value); 

(or whatever your variable name is for the result) as the statement just before the function returns. Use #ifdef to allow these debug lines to be turned on and off. Turn debugging off when you hand in your programs. Write a driver, main(), to allow you to test the function. Put the driver in the file named driver3.c You can compile this program with the command:

 cc driver3.c exponent.c 

18. Write a function, float pos_power(float base, int exponent); which returns the value of base raised to a positive exponent. For example, if base is 2.0 and exponent is 3, the function should return 8.0. If the exponent is negative, the function should return 0.

PLEASE WRITE IN C NOT C++

PLEASE INCLUDE POTOTYPE AND POS_POWER() FUNCTION

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions

Question

Analyse the process of new product of development.

Answered: 1 week ago

Question

Define Trade Mark.

Answered: 1 week ago

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago