Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function that takes as input parameters an integer, and an address of an integer (a pointer to an integer). Inside the function, create

Write a function that takes as input parameters an integer, and an address of an integer (a pointer to an integer). Inside the function, create an array the length of the first integer. Fill in the array with random numbers between 0 and 500. Print out the array. Modify the second parameter so that it points to the largest value in the array you just created.

In your main, create an integer variable and set it to -1. Create a second integer variable and set it to 15.

Call the function with the second integer as the length, and the address of the first integer.

In Main print out the first variable.

Call the function again, with the second integer as the length and the first variable.

In Main, print out the first variable

Call the function a third time, with the second integer as the length and the first variable.

In Main, print out the first variable. The value printed out should be the largest random number generated in all three calls to the function.

for readability, to print out an array, you could do this:

cout << arr[i] <<, ;

And then when the loop is done (outside the loop) you could do

cout << endl;

Your array will look something like this:

32, 41, 253, 439, 19, 273, 384, 212, 97, 116, 193, 269, 321, 449, 182

Write a function that takes as input parameters a length parameter (an int), and two more int parameters that will be modified using pass by reference. When the function is called the second and third parameters are initialized to -1 (before the function call). The function should should generate a random array the length of the length parameter, with the numbers between 100 and 300. The function should print the array, and then locate the smallest value in the array, modifying the third parameter to be the smallest value and the fourth to be the index location of the smallest value. Make sure you print these values after youve returned from the function.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions