Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Requirements: - in this exercise, please do not include and use string class. The function is using only array notation and manipulation. - string functions

Requirements:
- in this exercise, please do not include and use string class. The function is using only array notation and manipulation.
- string functions such as strlen is not allowed.
- it should not have multiple return statements in the same function
- there should be no global variable.
- the function should not traverse the arrays more than once (e.g. looping through the array once only)

  1.  A c++function named "analyze" that accepts an array of characters terminating by a NULL character (C-string). It will return the following info to the caller through the return  and parameters: the number of blanks, digits, uppercase and lowercase characters.
    For example, if this function is called with this passed array of {'H', 'e', 'l', 'l', 'o', ' ', '0', '1', '2', '3', '!', '0'}, it will return 1 for the number of uppercase characters, 4 for the number of lowercase characters, 1 for the number of blank, and 4 for the number of digits.

 A c++ function named "swapTheFirstTwoWithTheLastTwo" that accepts an array of integers and its size. If the array has 4 or more elements, it will swap the first two elements with the last two elements in the array.

For example, if it is called with the array of {10, 20, 30, 40}, it will swap to become {30, 40, 10, 20}.
If it is called with the array of {10, 20, 30, 40, 50}, it will swap to become {40, 50, 30, 10, 20}.
If it is called with the array of {10, 20, 30}, it will not swap and the array remains the same.

  1. A c++ function named "isTheLastNumberTheMax" that accepts an array of integers and its size. It will return true if the last number in the array is the maximum number in that array and false otherwise. In addition, it also returns another Boolean to indicate whether this list contains more than one maximum value.
    For example, if this is called with the array of {10, 20, 30, 40, 50}, it will return true and false
    If this is called with the array of {50, 10, 20, 30, 40, 50}, it will return true and true.

 a c++ function named "changeCase" that takes an array of characters terminating by NULL character (C-string) and a boolean flag of toUpper. If the toUpper flag is true, it will go through the array and convert all lowercase characters to uppercase. Otherwise, it will convert all uppercase to lowercase.

For example, if the array is {'H', 'e', 'l', 'l', 'o', '0'} and the flag is true, then the array will become
{'H', 'E', 'L', 'L', 'O', '0'}. And if the flag is false, the array will become
{'h', 'e', 'l', 'l', 'o', '0'}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Here are the C functions as per your requirements include Function to analyz... 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_2

Step: 3

blur-text-image_3

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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

For each, show how or explain why not. If Can C = 0? Can C

Answered: 1 week ago

Question

For each, show how or explain why not. If Can Can

Answered: 1 week ago