COMP-122 C++ 1.(TCO 6) Write a function called AnalyzeData. This function is pas
ID: 3693605 • Letter: C
Question
COMP-122
C++
1.(TCO 6) Write a function called AnalyzeData. This function is passed a double array along with a parameter that indicates the number of elements in the array. It is also passed a double value. The function computes and returns the number of values in the array that are greater than this double value. Write a complete C++ function to do this operation. There is no cin or cout in this function. This is only a function, so there is no main routine here!
2.(TCO 5) Write a function that takes inputs of quarts and pints (whole numbers), then calculates and returns an output of the total number of gallons (a floating-point value). There are 4 quarts in a gallon, and 2 pints in a quart. Use appropriate parameter passing and return mechanisms. Use appropriate datatypes. For example, with inputs of 4 quarts and 4 pints, the result would be 1.5 gallons. Use proper code formatting techniques. Do not write a main routine. Your function does not do cin or cout.
3.(TCO 5) Write a function that converts an input of some integer number of inches into outputs of integer numbers of yards, feet, and inches. Do not write a main function. Your function does not do cin or cout. Your function will have four parameters. Make sure you use appropriate parameter passing techniques! Your function will be a void function. There are 12 inches in a foot, and 36 inches in a yard. For example, if the total number of inches input is 50, the results are 1 yard, 1 foot, and 2 inches.
4.(TCO 7) Write a function which takes a C string as an input and counts the number of non-alphabetic characters in the C string. Non-alphabetic characters include anything outside the ranges 'a' thru 'z' and 'A' thru 'Z'. Do not count the null terminator. You are not allowed to use any other functions to do this. Do not write a main function. Your function does not do any cin or cout. Remember, C strings are terminated with the '' character. Make sure to properly format all your code.
5. (TCO 7) Write a function which takes one string variable (not C string) as input and appends additional information to the existing string. The function must get a first and last name from the user and add them to the original string so the final string appears as follows:
original_string_content|first_name|last_name
You must add the '|' character to the string as shown. Use an appropriate parameter passing mechanism. Do not write a main function. Make sure to properly format all your code.
Explanation / Answer
ANSWER
Simplest as:
Other possible solution could be putting the index to be the last index of the string. Then you are going to read the string letter by letter backwards, lowering the index value by 1 each time. Then the code snipplet that you showed could become:
Using the interactive interpreter (just type 'python' in a command prompt) could help you experiment with such code snipplets. Like for example:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.