computer. C++ coding

anjns89
timer Asked: Dec 11th, 2013

Question Description

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:

#include <iostream>

using namespace std;

// Function prototype(s):

void f_vDisplayArray();

void f_vDisplayHistogram(char);

int main()

{

 // Declarations:

   

// Return control to Windows:

 return 0;

}

// Function header and definition for a function that…:

void f_vNameOfFunction(p_xArgs)
{

// Local variable declarations:

// Return to the calling program:

return 0;

}

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:


User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

This question has not been answered.

Create a free account to get help with this and any other question!

Related Tags

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors