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
ANEK [815]
3 years ago
8

Write a function that determines the maximum and minimum values from a one-dimensional array. Assume that the corresponding func

tion prototype statement is void ranges(int x[], int npts, int *max_ptr, int *min_ptr) where npts contain the number of values in array x, and max_ptr and min_ptr are pointers to the variables in which to store the maximum and minimum values in the array.
Computers and Technology
1 answer:
erica [24]3 years ago
8 0

Answer:

void ranges(int x[], int npts, int *max_ptr, int *min_ptr)

{

   *max_ptr=*min_ptr=x[0];

   for(int i=1;i<npts;i++)

   {

       if(x[i]>*max_ptr)        //this will put max value in  max_ptr

           *max_ptr=x[i];

       if(x[i]<*min_ptr)  //this will  put min value in min_ptr

           *min_ptr=x[i];

   }

}

Explanation:

The above function can be called like :

                                    ranges(x,n,&max,&min);  

where x is array and n is number of elements and max and min are address of variables where maximum and minimum values to be stored respectively.

You might be interested in
Write a program that allows the user to play a guessing game. The game will choose a "secret number", a positive integer less th
Burka [1]

Answer:

// This program is written in C++

// Comments are used for explanatory purpose

// Program starts here

#include<iostream.h>

#include<stdlib.h>

int main()

{

// Declare variables

int num, selectno;

string status;

randomize();

//Generate random number;

num=rand()%10000;

// Prompt to guess a number

cout<<"You have only 10 tries\nTake a guess: ";

int tries = 0;

while (tries != 10)

{

cin>>selectno;

if(selectno == num){

cout<<"You passed at the "<<count+1<<" attempt";

tries = 10;

}

else

{

cout<<"You failed. Take another guess\n You have "<<10 - count + 1 <<" attempts";

}

tries++;

if(tries >= 10)

{

break;

}

}

return 0;

}

8 0
3 years ago
Explain how to number text in a document​
uranmaximum [27]

Answer:

Lol

Explanation:

Yes iri

8 0
3 years ago
Read 2 more answers
When you ask the database more complex questions using comparison operators, you are conducting a _____. sort questionnaire quer
Mice21 [21]
The correct answer is known as a "query".

When you ask a lot of complex questions , which uses comparison operators, that is called a query. A query refers to the <span>exact request for </span>data retrieval<span> with the use of database and information systems. </span>
8 0
3 years ago
Aye yo, how do I get rid of an already placed end crystal? I thought it looked cool to build in my minecraft survival house, and
SpyIntel [72]

Answer:

they can be removed safely if they're immersed in water first.

Explanation:

8 0
3 years ago
Read 2 more answers
Select all that apply.
bagirrra123 [75]

Answer:

explain

Explanation:

sorry didn't understand a thing you said except copying and pasting documents

3 0
3 years ago
Read 2 more answers
Other questions:
  • What is the formula equivalent to the function =SUM(B1:B5)?
    11·2 answers
  • When you divide a picture into thirds, how many parts do you end up with? *
    14·2 answers
  • Which type babshshshhsshshhshshshhshs
    13·1 answer
  • Match the steps with the actions that are involved when an internal host with IP address 192.168.10.10 attempts to send a packet
    11·1 answer
  • What weight pencil is recommended for darkening lines and for lettering? *
    7·2 answers
  • Which of the following people choose a career path for the right reasons
    12·2 answers
  • Which tab do you select to change how you see your Word document on screen?
    9·2 answers
  • Chris needs to modify the default bullets that are used in a nonnumbered list in Word.
    12·2 answers
  • A(n) ________ cloud does not free an organization from the issues associated with managing the cloud infrastructure, but it does
    7·1 answer
  • This is your code.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!