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
Lorico [155]
3 years ago
15

Given the char * variables name1, name2, and name3, write a fragment of code that assigns the largest value to the variable max

(assume all three have already been declared and have been assigned values).
Computers and Technology
1 answer:
Assoli18 [71]3 years ago
4 0

Answer:

The following code as follows:

Code:

max=name1;   //define variable max that holds name1 variable value.

if (strcmp(name2, max)>0)  //if block.

{

   max=name2;  //assign value to max.

}

if (strcmp(name3,max)>0)   //if block.

{

  max=name3; //assign value to max.

}

Explanation:

In the above code, we define a variable that is max. The data type of max variable is the same as variables "name1, name2, and name3" that is "char". In the max variable, we assign the value of the name1 variable and use if block statement two times. In if block, we use strcmp() function that can be defined as:

  • In first if block we pass two variables in strcmp() function that is "name2 and max" that compare string value. If the name2 variable is greater then max variable value so, the max variable value is change by name2 variable that is "max=name2".
  • In second if block we pass two variables in strcmp() function that is "name3 and max" that compare string value. If the name3 variable is greater then max variable value so, the max variable value is change by name3 variable that is "max=name3".

You might be interested in
Who do you guys ship lol bit with?
LekaFEV [45]

Answer:

nobody

Explanation:

8 0
3 years ago
Read 2 more answers
What are options in the Advanced tab in the Share Workbook dialog box? Check all that apply
madam [21]
Where are the options

7 0
3 years ago
Read 2 more answers
An educational institution has a number of buildings in the campus. Each building has its own independent network system, and al
Aloiza [94]
Answer: star topology.

Explanation:

The layout of the way how the computers in a netword are interconnected is called network tipology.

Some types of network topologies are:

1) Point-to-point tipology: all the computers are connected to each other directly (computer-to-computer, in pairs, this is a direct link between each two computers).

2) Bus topology: all the nodes (computers or server) are connectect to a maing cable.

3) Star topology: all the computers are connected to a central computer or server which is called central hub. This is the layout described in the question.

4) Ring topology: the computers are connectec in a circular path; each computer is connected to the next computer.

5) Mesh: every computer is connected to every other computer.




8 0
3 years ago
Read 2 more answers
On "assignments" what does XMPT mean?
tresset_1 [31]

Exempt is what it means


3 0
3 years ago
Photographing during the midday can produce which of the following?
deff fn [24]
It can produce harsh shadows
5 0
3 years ago
Read 2 more answers
Other questions:
  • Carlos owns a hardware store. He currently is not using any software to track what he has in the store. In one to two sentences,
    9·2 answers
  • A power supply unit for a computer converts:
    7·1 answer
  • g Design a Boolean function called isPrime, that accepts an integer as an argument and returns True if the argument is a prime n
    14·1 answer
  • A class is a _____, which encapsulates _____ and _____. (Points : 2) programming language construct; attributes; behavior
    7·1 answer
  • A report has a column of totals, with each total adding to the cell above it. What kind of calculated figure is this?
    15·1 answer
  • Given a matrix input_matrix, return a Numpy array that consists of every entry of A that has: an even row index in the range [0,
    9·1 answer
  • Who is the intended audience of a pseudocode document?
    14·1 answer
  • Pls help have absolutely no clue how to delete this
    12·2 answers
  • Elan inserted shapes into a slide in his presentation. What is the quickest way to format those shapes?
    8·1 answer
  • Choose the answer.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!