Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ please Use each function definition in a program to test the function. 1. Write a function, power, that computes the power of a number.

C++ please
Use each function definition in a program to test the function.
1. Write a function, power, that computes the power of a number. The arguments to the function are the base and the exponent, such that power(2,4) returns 2 to the fourth power. Use either a while loop or a for loop in your function definition.
2. Write a function, ftoc, that takes a Fahrenheit temperature as the argument and returns the Celsius equivalent. The formula to use is: C = 5/9(F - 32). Be sure to account for floating-point values.
3. Write a function, fallingd, that computes the distance an object falls in a specific time period. The formula to use is: d = 1/2gt^2, where ^ is the exponent operator. The value of g is 9.8, and the value t is the time in seconds the object has been falling.
4. The following code loops through a string, displaying each character of the string:
string word = "balance";
for (int i = 0; i < word.length(); i++) {
char c = word[i];
cout << c;
}
Write a Boolean function, contains, that takes a word and a letter as arguments and returns true if the word contains the letter and false otherwise.

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

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions