Combined Skills (Void Functions, Nested For Loops, Arrays, Global Values)
Use this starter code for these problems. This is a lot shorter than our standard starter code. By "de-cluttering" the screen you'll be able to see what's going on better:
using namespace std;
// Function prototype(s):
// Return control to Windows:
// Function header and definition for a function that…:
// Local variable declarations:
// Return to the calling program:
Problem 1 (name this Lab10_Problem1)
Step 1: Start a "skeleton" program using the starter code above.
Step 2: Declare a global array to store 10 integer values. Name your array "iVals." Use the shortcut method to assign 10 arbitrary integer values to the array elements ranging from 1 to 25.
Remember, to declare something as global, all you need to do is declare it BEFORE int main() and AFTER using namespace std;
Step 3: Write a function call in the main() program to call the function f_vDisplayArray() to display each value stored in the array. The function should display the values stored in the array, one value per line (just display the integer value—nothing else). Test your program.
Step 4: Write a function call in the main() program to call void f_vDisplayHistogram('*') to display a histogram based on the values stored in the array. Based on the character you pass, the function should display a row made up of a series of characters. The specific character displayed will depend on what you pass to the function using the char argument. If you’re your program is working correctly, each row will have as many characters as the value stored in the array. Note: in the first sentence above, an * (asterisk) is the character chosen to be passed to the function. Test your program.
Example: suppose the array stored a value of 7 in the element referenced in subscript 3. Your output should look like this, assuming you passed it * for the character argument: