1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
atroni [7]
3 years ago
11

Write a program to randomly fill an array of float of 10 elements (use the rand() function and make sure to use #include ) in ma

in then define a function to find the maximum element in the array using pointers and return the max element to main then print it on screen.
Computers and Technology
1 answer:
Lilit [14]3 years ago
4 0

Answer:

#include <iostream>

#include <stdlib.h>

#include <time.h>

using namespace std;

// array fill and returnig array to the main()

float *arrayFill(float *arr) {

// srand() allows generate new random value everytime the program runs

srand(time(NULL));

for (int i = 0; i < 10; i++)

{

 // array fill with random number between 0 to 100

 arr[i] = (rand() % 100);

}

return arr;

}

// print array

void print(float* arr) {

cout << "Array:  ";

for (int i = 0; i < 10; i++)

{

 cout << arr[i] << "   ";

 

}

}

float maxNum(float* arr) {

float temp = arr[0];

for (int i = 1; i < 10; i++) {

 if (temp < arr[i]) {

  temp = arr[i];

 }

}

return temp;

}

int main() {

// creating dynamic array of elements 10 in heap memory

float *arrPtr = new float[10];

float result = 0;

// calling arrayFill()

arrPtr = arrayFill(arrPtr);

// calling print() to print array

print(arrPtr);

// calling maxNum() to find maximum number in the array

result = maxNum(arrPtr);

cout << "\nmaximum number: " << result;

delete[] arrPtr;

return 0;

}

Explanation:

please read inline comments inside the code section:)

You might be interested in
WHAT SO THESE THINGS THAT I'VE HIGHLIGHTED MEAN IN MICROSOFT WORD?
sergij07 [2.7K]

the numbers are the size of the letters you type. the ab with the line through it is for marking stuff off of like a list or something. and the one all the way on the right I can't see good enough to tell what it is.

6 0
3 years ago
Elisa and Josh need to access General Help. Elisa will press the F1 key. Josh will click on ? in the upper-right corner of the W
astraxan [27]
It will be elisa who will get to it
3 0
3 years ago
Read 2 more answers
Which of the following is where you can save, select a template, change document properties, and close or exit excel?
Aneli [31]
It is the 'backstage' in which you can <span>save, select a template, change document properties, and close or exit excel</span>
5 0
3 years ago
Which of the following is not regression test case? A. A representative sample of tests that will exercise all software function
AveGali [126]

Answer:

D. Low-level components are combined into clusters that perform a specific software sub-function

Explanation:

Normally, regression testing are done on a manual basis by simply re-executing a subset of the entire available test cases or it can be done automatically by utilizing playback tools or automated capture. Hence, from the options, a combination of low-level components into clusters that perform a specific sub-function does not align with how regression testing are done either manually or automatically.

6 0
3 years ago
Which of the following is not a concern that has come out of the widespread adoption of the Internet?
slamgirl [31]

Answer:

The correct option is;

Selecting the correct browser to use for the sites you want to visit

Explanation:

Censorship of information is the subduing of information based on the consideration of such information being harmful or inconvenient

Increased anonymity

Making an individual anonymous which is one of the capabilities of the internet, is seen as encouraging unethical behavior and promoting discussions which are deemed uncivil in a commonly shared space online.

Unauthorized sharing of copyrighted information

The sharing and distribution of copyrighted material is against the law but it is a common occurrence and in various formats online

Out of the given options, selecting the correct browser to use for the sites you want to visit is the one that is not a concern.

5 0
3 years ago
Other questions:
  • Jason is creating a webpage on the basic parts of a camera. He has to use a mix of both images and content for the web page to h
    11·1 answer
  • Given positive integer num_insects, write a while loop that prints that number doubled up to, but without exceeding 100. Follow
    8·1 answer
  • ________ are used to translate each source code instruction into the appropriate machine language instruction.
    11·1 answer
  • After a chart has been inserted and formatted, is it possible to change the data range it refers to or to add new rows of data?
    14·1 answer
  • Impaired drivers are one of the many risks drivers face on the Highway Transportation System. List 3 signs that a driver could b
    10·2 answers
  • What game is this? help mee?
    8·2 answers
  • What would the internet be like today if there was no World Wide Web?
    9·1 answer
  • Find the output<br>I need it immediately​
    15·1 answer
  • What is one of the limitations of marketing in social media?.
    13·1 answer
  • question 5 you need to find the internet protocol (ip) address for a website. which command do you use on a windows system?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!