Task: Working with Arrays
Overview
In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, we'll use the values to calculate some basic statistics.
Instructions
Lets get started.
1. Create your own Working With Arrays project, and copy in the code of your user input functions, or your custom terminal user input code file and header.
2. Add the following functions and procedures based on the week's videos:
Create an index of function which will return the index of a given name in the array. This should return -1 if the name is not present.
int index_of(string value, string data[], int size)
Hint: Use similar logic to was found.
contain from the video, but return the index where the name
Create a print summary procedure that accepts the array and its size, then prints out all of the names, the total length of these names, the index of your name (or -1 if your name is not in the array), and the shortest name.
void print_summary(string data[], int size)
Have main create and work with an array of strings
Use a constant for the size (make it 5) Loop to read in the names
Call print summary to output the details
3. Run your program twice to test both with and without your name in the array, then grab a screenshot of the output.