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
PLEASE HELP I'M TAKING A QUIZ AND I HAVE 5 MINUTES LEFT
larisa [96]

Answer:

pp popo

Explanation:

6 0
3 years ago
Read 2 more answers
If a node has a wireless connection to the internet, does that node have to be mobile
Marizza181 [45]
No it does not . answers
8 0
3 years ago
Jorge is sending a large image file to a friend as part of a shared classroom project. Which of the following is most likely tru
madreJ [45]

Answer:

D. The image will require fewer bits in order to be represented.

Explanation:

Lossy compression algorithms are typically better than lossless compression algorithms at reducing the number of bits needed to represent a piece of data.

5 0
3 years ago
Question 11 of 20
asambeis [7]

Answer: A.) To convince your manager to use a new meeting organization tool

Explanation:

4 0
2 years ago
How many Packs of cigarettes in one carton? 6, 8, 10, 12 ?
Gnesinka [82]
There are 8packs of 25, or 10 packs of 20 depending on the brand.... both adding up to 200 cigarettes total.

6 0
3 years ago
Other questions:
  • If you want to boot from a hard drive what must it have
    6·1 answer
  • Which tab is used to insert a hyperlink onto a slide
    8·2 answers
  • Free points! your welcome
    9·2 answers
  • A user of the wireless network is unable to gain access to the network. The symptoms are:1.) Unable to connect to both internal
    6·1 answer
  • Effective presentations vary the color scheme on each slide.<br><br> True<br> False
    5·2 answers
  • The program is to be answered in Java Programming not C++ Please answer the following: Modify the BarChart program to accept the
    6·1 answer
  • 10 points!
    12·1 answer
  • Subcribe to me for brainly my YT is KeepUsweatin
    9·1 answer
  • Please define processor​
    14·1 answer
  • imagine that you are explaining the art of visual comparison to a group of photography students. You are mentoring. What do you
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!