Answered step by step
Verified Expert Solution
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started