Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Objectives By completing this homework, students should be able to: . Write various string functions . Write a function with a pass-by-reference parameter Task 1
Objectives By completing this homework, students should be able to: . Write various string functions . Write a function with a pass-by-reference parameter Task 1 (10 points) Write a program called mystring . opp. The program should have several functions: 1. string lower (string word) // e.g. Hello => hello 2. string upper (string word) // e.g. Hello => HELLO 3. string capitalize (string word) // e.g. hello => Hello 4. string reverse (string word) // e.g. Hello => olleH 5. These functions return a string as indicated in the examples above from the word it gets as an argument. The program should loop until the user enters "quit". Task 1 Sample Output Please enter a word: String-Character Lower case: string-character Upper case: STRING-CHARACTER Capitalize: String-character Reverse: retcarahC-gnirts Please enter a word: quit Task 2 (10 points) A Fibonacci number sequence is a series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ... The next number is calculated by adding up the two numbers before it. Write a program called fib . opp. The program will print out the n Fibonacci Number using a function called: void FibonacciNumber (int n, int& fib_no) This function will calculate the n term in the Fibonacci Numbers and return it in fib_no. By definition, the function returns 0 for n = 1 and returns 1 for n = 2. For the subsequence number: nth = (m - 2)th. + (m - 1)th. You need to verify the input n > 0.Note that the first 2 numbers (i.e., 0 and 1) are given, they cannot be computed. Therefore ifn = 1, the function simply returns "O". Ifn = 1, the function simply returns "O, 1". Hint: function skeleton: void FibonacciNumber (int n, int& fib no) if (n == 1) cout
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