Computer Science Homework Solutions
Problem
#165868

Arrays and Strings

Please do not make the codes too complicated.  Our topic for this program is Arrays and Strings.  See attached file.

Attached file(s):
Attachments
Chap9_Ex.9.doc  View File

Attachment Content Summary (Note: view attachment at the above link before purchasing. Actual attachment content may vary slightly from that shown below.)

Chap9_Ex.9.doc
Consider the following function main:

int main ()

{

Int inStock [10] [4];

Int alpha [20];

Int beta [20];

Int gamma [4] = {11, 13, 15, 17};

Int delta [10] = {3, 5, 2, 6, 10, 9, 7, 11, 1, 8};

.

.

.

}

Write the definition of the function setZero that initializes any
one-dimensional array of type int to 0.

Write the definition of the function inputArray that prompts the user to
input 20 numbers and stores the numbers into alpha.

Write the definition of the function doubleArray that initializes the
elements of beta to two times the corresponding elements in alpha. Make
sure that you prevent the function from modifying the elements of alpha.

Write the definition of the function copyGamma that sets the elements of
the first row if inStock to gamma and the remaining rows of inStock to
three times the previous row of inStock. Make sure that you prevent the
function from modifying the elements of gamma.

Write the definities of the function copyAlphaBeta that stores alpha
into the first five rows of inStock and beta into the last five rows of
inStock. Make sure that you prevent the function from modifying the
elements of alpha and beta.

Write the definition of the function printArray that prints any
one-dimensional array of type int. Print 15 elements per line.

Write the definition of the function setInStock that prompts the user to
input the elements for the first column of inStock. The function should
then set the elements in the remaining columns to two times the
corresponding element in the previous column, minus the corresponding
element in delta.

Write C++ statements that call each of the functions in parts a through
g

Write a C++ program that tests the function main and the function
discussed in parts a through g. (Add additional functions, such as print
a two-dimensional array, as needed.)
Solution
What is this?
By OTA - Overall OTA Rating
Purchase Cost Now
$2.19 CAD (was ~$31.92)
Included in Download
  • Plain text response
  • Attached file(s):
    • solution.cpp
$2.19 Instant Download
Add to Cart
Why you can trust BrainMass.com
  • Your Information is Secure
  • Best Online Academic Help Service
  • Students find real academic Success
Related Solutions
Browse