Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
