in c  Problem  Print Patterns Using Loops] Write down a program to initialize an integer array ‘a[ ]’ of size 10 , all initialized to 0. Add the following functions to your program and use them in your main function: A function ‘enterValues( )’ that asks a user to enter 10 integer values, one by one, and assigns them to array ‘a[]’. A function ‘printValues( )’ that takes array ‘a[]’ as a parameter and prints all of its 10 values. A function ‘randomMultiply( )’ that generates a random integer ‘mfac’ between 1 and 4 and multiplies ‘mfac’ with all elements of array ‘a[]’. This change should be done to the original array ‘a[]’ and should be displayed in the main( ) function by using the printValues( ) function. A function ‘randomChange( )’ that should randomly generate an index number ‘rInd’ between 0 and 9 and replace the element of array ‘a[ ]’ at ‘rInd’ by the number 100. This change should be done to the original array ‘a[]’ and should be displayed when the array is printed in the main() function by using the printValues( ) function. Ensure that the ‘printValues( )’ function is only able to print the values of ‘a[ ]’ but is never able to change its values?

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section7.1: One-dimensional Arrays
Problem 8E: (Data processing) a. Write a program to input 10 integer numbers in an array named fmax and...
icon
Related questions
Question

in c 

Problem 

Print Patterns Using Loops]

Write down a program to initialize an integer array ‘a[ ]’ of size 10 , all initialized to 0. Add the following functions to your program and use them in your main function:

  1. A function ‘enterValues( )’ that asks a user to enter 10 integer values, one by one, and assigns them to array ‘a[]’.
  2. A function ‘printValues( )’ that takes array ‘a[]’ as a parameter and prints all of its 10 values.
  3. A function ‘randomMultiply( )’ that generates a random integer ‘mfac’ between 1 and 4 and multiplies ‘mfac’ with all elements of array ‘a[]’. This change should be done to the original array ‘a[]’ and should be displayed in the main( ) function by using the printValues( ) function.
  4. A function ‘randomChange( )’ that should randomly generate an index number ‘rInd’ between 0 and 9 and replace the element of array ‘a[ ]’ at ‘rInd’ by the number 100. This change should be done to the original array ‘a[]’ and should be displayed when the array is printed in the main() function by using the printValues( ) function.
  5. Ensure that the ‘printValues( )’ function is only able to print the values of ‘a[ ]’ but is never able to change its values?
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage