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
The fastest way to get help is to type a word or two in the search box.
Elanso [62]
The fastest way to get help is to type a word or two in the search box. TRUE.
5 0
3 years ago
Lukas entered the date 9-17-2013 in an Excel workbook. He wants the date to appears as “Tuesday, September 17, 2013.” Instead of
Sphinxa [80]
<span>The answer is highlight cells, select the Insert tab, click on the number, select Date from the category box, highlight the correct format, and click OK.</span>
8 0
3 years ago
2. Name the type of product the United States used to<br> first enter the arena of technology.
skelet666 [1.2K]

Answer:

<u><em>please mark brainliest!</em></u>

Explanation:

Benjamin Franklin found and acquainted power (electricity) with the USA. He likewise had numerous different developments such the wood stove. Benjamin Franklin initially stunned himself in 1746, while leading examinations on power with discovered items from around his home. After six years and precisely 261 years back today, the establishing father flew a kite joined to a key and a silk lace in a storm and adequately caught lightning in a jug.

3 0
3 years ago
Everybody at a company is assigned a unique 9 digit ID. How many unique IDs exist?
Brut [27]
If you include all zeroes, then it should be 1,000,000,000. Otherwise it’s 999,999,999.

Think of how between 0-9 theres 10 numbers, and use that logic towards 000000000-999999999
3 0
3 years ago
What is the most important external issue when using social media in emergency management?
DerKrebs [107]
Th e most important external issue when using social media in emergency management is the disaster response. Disseminating information through social media is very effective especially when there are calamities and a disaster respond from both private and public sector is very urgent.
8 0
3 years ago
Other questions:
  • If you were optimizing for performance and wanted to support potentially adding many new elements to an adt, then:
    12·1 answer
  • In this exercise, use the following variables : i,lo, hi, and result. Assume that lo and hi each are associated with an int and
    9·1 answer
  • Elizabeth works for a local restaurant At the end of her shift, she is required
    15·2 answers
  • You have been given the job of creating a new order processing system for the Yummy Fruit CompanyTM. The system reads pricing in
    8·1 answer
  • Explain 3 ways you can be an upstander when seeing cyberbullying.
    13·2 answers
  • Which type of styles can be applied to a word, phrase, or sentence?
    7·1 answer
  • Binary is used to store what on a computer?<br> •Data<br> •Dates<br> •Address
    13·2 answers
  • What is NOT a built-in function in python?<br> sqrt()<br> string()<br> fabs()<br> O print()
    12·2 answers
  • Your first submission for the CIS 210 Course Project should include the following functionality: - Requests the user to input hi
    13·1 answer
  • 10.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!