Wyo C++ | Name - | |
Ch. 8 Worksheet #3 | Group Partner (if applicable) - |
Pseudocode the following programs using iteration (loops) and decision (if or switch) statements where necessary, efficient, and appropriate. Be sure to amply pseudocode the algorithm so that another programmer could then follow the pseudocode to write a program modelled on that pseudocode. Try to refrain from using specific C++ syntax but you may use the words if, then, loop, variable, mod, string, or even arrows. You should also use indentation and white space to make your pseudocode easy for others to read and understand.
1. Write a program that obtains a user-inputed nonnegative integer and then
efficiently computes and displays its factorial. (Example: 4! = 4 * 3 * 2 *
1 = 24)
2. Write a program that efficiently computes and displays the value of the
mathematical constant e by using the following formula. Compute the formula
as accurately as you reasonably can given data type range, processor speed,
and other system resource restrictions.
e = 1 + 1/1! + 1/2! + 1/3! + ...
3. Write a program that converts a decimal value to a binary value. You are guaranteed that the decimal value is less than 128. Review this page for an algorithm to change values from one base to another. See this page to test your answers.
4. Write a program that converts a binary value to a decimal value. You are guaranteed that the binary value will have 7 digits or less.
5. Write a program that reads a five-character apstring as a string (not as an integer) and then efficiently determines whether or not it is a palindrome. (A palindrome is a number or a text phrase that reads the same backwards as forwards.)