in c++ Exercise Tasks: Create a project Ex8 and .cpp file. When you are finished with the exercise, please submit the corresponding .cpp file using moodle. For tasks 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, (http://en.wikipedia.org/wiki/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 (http://en.wikipedia.org/wiki/Mode_(statistics) ) . 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. Go to http://www.gutenberg.org/, obtain a .txt copy of Austen’s Emma. Create a string s in your code containing the first 10 paragraphs in Emma. 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.
in c++
Exercise Tasks: Create a project <yourfirstandlastName>Ex8 and .cpp file. When you are finished with the exercise, please submit the corresponding .cpp file using moodle. For tasks 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, (http://en.wikipedia.org/wiki/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 (http://en.wikipedia.org/wiki/Mode_(statistics) ) . 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.
- Go to http://www.gutenberg.org/, obtain a .txt copy of Austen’s Emma. Create a string s in your code containing the first 10 paragraphs in Emma. 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.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images