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
Juli2301 [7.4K]
3 years ago
6

Write a function that returns a pointer to the MAXIMUM value of an array of double values. If the array is empty, return NULL. d

ouble* maximum(double *a, int size) { }
Computers and Technology
1 answer:
marusya05 [52]3 years ago
8 0

Answer:

double* maximum(double *a, int size) {

if(size == 0)

return NULL;

int i;

double max = 0.0;

double *mp;

for(i = 0; i < size; i++){

if(a[i] > max){

max = a[i];

mp = &a[i];

}

}

return mp;

}

Explanation:

You iterate through the vector and find the maximum value. You go updating the pointer throughout the loop. I am going to write a C function

double* maximum(double *a, int size) {

if(size == 0)

return NULL;

int i;

double max = 0.0;

double *mp;

for(i = 0; i < size; i++){

if(a[i] > max){

max = a[i];

mp = &a[i];

}

}

return mp;

}

You might be interested in
PLZ HELP!!! I'm a beginner in coding!
Lina20 [59]

import random

rock,paper,scissors = 1,2,3

choice = int(input("Please choose 1 2 or 3: "))

computer = random.randint(1,3)

player_won = False

draw = False

if choice == computer:

   draw = True

elif choice == 1 and computer == 3:

   player_won = True

elif choice == 2 and computer == 1:

   player_won = True

elif choice == 3 and computer == 2:

   player_won = True

if player_won:

   print("You won!")

elif not player_won and not draw:

   print("The computer won!")

else:

   print("It's a draw!")

First, I recommend importing at the beginning of your program. Also, you can combine all your same datatype variables in one line. You also need to cast your user choice to an integer so you can compare it with the computer's choice. I wrote the if, elif, and else statements using a boolean variable. I simply wrote all the possibilities that would result in the player winning and this would result in the player_won variable being true. If this is the case, we print to the console, "You won!"

4 0
3 years ago
Which one of following is an example of a formatted number using the Currency option?
scoundrel [369]
C.) $7,778.92 is an example of a formatted number using the Currency option.

$ - is a currency symbol of the United States Dollars
, - is a currency symbol that separates whole numbers into group of 3 digits.
. - is a currency symbol that separates the whole amount from the centavos amount
7 0
4 years ago
100 POINTS!!!!
Alisiya [41]

Answer:

☆<em>intellectual property</em>☆

<u>intangible </u><u>a</u><u>s</u><u>s</u><u>e</u><u>t</u><u>s</u><u> </u><u> that result from intellectual</u><u> </u><u>p</u><u>r</u><u>o</u><u>p</u><u>e</u><u>r</u><u>t</u><u>y</u><u> </u><u>.</u>

<u>☆</u><u>I</u><u>n</u><u>t</u><u>a</u><u>n</u><u>g</u><u>i</u><u>b</u><u>l</u><u>e</u><u>☆</u><u>;</u>

<u>s</u><u>o</u><u>m</u><u>e</u><u>t</u><u>h</u><u>i</u><u>n</u><u>g</u><u> </u><u>t</u><u>h</u><u>a</u><u>t</u><u> </u><u>c</u><u>a</u><u>n</u><u>n</u><u>o</u><u>t</u><u> </u><u>b</u><u>e</u><u> </u><u>t</u><u>o</u><u>u</u><u>c</u><u>h</u><u>e</u><u>d</u><u>.</u>

<em>P</em><em>l</em><em>e</em><em>a</em><em>s</em><em>e</em><em> </em><em>M</em><em>a</em><em>r</em><em>k</em><em>☆</em>

<em>A</em><em>r</em><em>i</em><em>a</em><em>♡</em>

5 0
3 years ago
Which of the three is not a popular cloud suite or online office suite?
SIZIF [17.4K]
C. Thinksmart - thinksmart only sells products and softwares of their own. Thinksmart is a online selling company that sells moslty softwares on their domain. Think smart is not a popular cloud suite or an online office suite. So the answer to your question is C.
3 0
4 years ago
What is the potential outcome for an author if she uses a word without realizing its connotation? she may write something that s
zubka84 [21]

A potential outcome for an author who uses a word without realizing its connotation is: A. she may write something that she does not mean.

<h3>What is connotation?</h3>

Connotation refers to the quality, feeling or an idea which a word brings to the mind of a reader or listener, as well as its literal, dictionary or primary meaning.

This ultimately implies that, a potential outcome for an author who uses a word without realizing its connotation is that he or she may write something that she does not mean or pass across an information she didn't intend to.

Read more on connotation here: brainly.com/question/20236939

#SPJ1

3 0
2 years ago
Other questions:
  • When the atmosphere has too much carbon dioxide in it, the oceans absorb some of it to achieve a new balance. This is an example
    9·2 answers
  • Which type of microscope can only be used to view non-living specimens?
    10·2 answers
  • Give two differences between EIRGP and RIP.
    14·1 answer
  • Which of these programmers creates the core game engine?
    5·2 answers
  • Develop a Java application that provides program output in a logical manner and incorporates appropriate data types. Similar to
    6·1 answer
  • What will you see on the next line?
    6·2 answers
  • What is the use of comma and semicolon with print statement ?​
    11·1 answer
  • How can ICT be a tool in connecting all stakeholders in your community?
    5·1 answer
  • How is hashing used?
    6·1 answer
  • Is hp pavilion pc a digital or analog computer
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!