In C++ language For number 2 through 4 create an integer array with 100 randomly generated values between 0 and 99; pass this array into all subsequent functions. Place code in your main to call all the methods and demonstrate they work correctly. Using just the at, length, and substr string methods and the + (concatenate) operator, write a function that accepts a string s, a start position p, and a length l, and returns a subset of s with the characters starting at position p for a length of l removed. Don’t forget that strings start at position 0. Thus (“abcdefghijk”, 2, 4) returns “abghijk” Create a function that accepts the integer array described above returns the standard deviation of the values in a. The standard deviation is a statistical measure of the average distance each value in an array is from the mean. To calculate the standard deviation, you first call a second mean function that you need to write (do not use a built in gadget. Then sum the square of the difference of each value in the array a and that mean. The standard deviation is the square root of that sum divided by the number of elements in the array. Pay attention to what type of function your standard deviation and mean functions should be. As part of testing the functions, your main should display your test array in a square. Create a function frequencyCount that given a value target t, returns how many times t occurs in an integer array a. You need to write your own function, not a built in gadget. Create a function that returns the mode of the value in the array. You need to write your own, not use a built in gadget. The mode is the most frequently occurring value in the array. Your mode function will need to call your frequencycount function. To make things easier, if two or more different values have the same frequency count, we will simply return the smallest. Once you have tested your mode function with an array of length 100, test it with an array of length 10000 with randomly generated values between 0 and 9. I suggest not trying to display all 10000 values in the console window. Write code to move the integer values of each character (e.g. Ascii) in your string into an array of integers and calculate the mode of that array, which then should be converted back into a character. Write a function that accepts an array of integers and returns -1 if sorted in ascending order, 1 if sorted in descending order, and 0 if not sorted. To be as efficient as possible, your function should make only one pass through the array.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 8PE: Write a program that reads in a line consisting of a students name, Social Security number, user ID,...
icon
Related questions
Question

In C++ language

For number 2 through 4 create an integer array with 100 randomly generated values between 0 and 99; pass this array into all subsequent functions. Place code in your main to call all the methods and demonstrate they work correctly.

  1. Using just the at, length, and substr string methods and the + (concatenate) operator, write a function that accepts a string s, a start position p, and a length l, and returns a subset of s with the characters starting at position p for a length of l removed. Don’t forget that strings start at position 0. Thus (“abcdefghijk”, 2, 4) returns “abghijk”

  2. Create a function that accepts the integer array described above returns the standard deviation of the values in a. The standard deviation is a statistical measure of the average distance each value in an array is from the mean. To calculate the standard deviation, you first call a second mean function that you need to write (do not use a built in gadget. Then sum the square of the difference of each value in the array a and that mean. The standard deviation is the square root of that sum divided by the number of elements in the array. Pay attention to what type of function your standard deviation and mean functions should be. As part of testing the functions, your main should display your test array in a square.
  3. Create a function frequencyCount that given a value target t, returns how many times t occurs in an integer array a. You need to write your own function, not a built in gadget.
  4. Create a function that returns the mode of the value in the array. You need to write your own, not use a built in gadget. The mode is the most frequently occurring value in the array. Your mode function will need to call your frequencycount function. To make things easier, if two or more different values have the same frequency count, we will simply return the smallest. Once you have tested your mode function with an array of length 100, test it with an array of length 10000 with randomly generated values between 0 and 9. I suggest not trying to display all 10000 values in the console window.
  5. Write code to move the integer values of each character (e.g. Ascii) in your string into an array of integers and calculate the mode of that array, which then should be converted back into a character.
  6. Write a function that accepts an array of integers and returns -1 if sorted in ascending order, 1 if sorted in descending order, and 0 if not sorted. To be as efficient as possible, your function should make only one pass through the array.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning