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
Remember that kid who would always ask you for your food, even though he packed his own lunch.
Verizon [17]

Answer:

ye ye

Explanation:

7 0
3 years ago
Read 2 more answers
Edhesive code practice 4.8 Question 3
vovangra [49]

Answer:

for i in range(200,301,2):

  print(i)

Explanation:

just copy and paste 100 percent

3 0
3 years ago
Read 2 more answers
In your own words, what does Hypertext Markup Language [HTML] do?
nexus9112 [7]

Answer:

HTML dictates how the browser presents images and text on a webpage.

Explanation:

3 0
3 years ago
Read 2 more answers
If you want a language that is relatively easy to write and which can be tested easily as it's being developed, you would choose
Oksi-84 [34.3K]

Answer:

true

Explanation:

because it needs a interpreter so that it could be more developed

3 0
3 years ago
. What projects would Excel best be used for?
adoni [48]

Answer:

Projects that require spreadsheet organization and/or calculations between data

Explanation:

That is why Excel is a spreadsheet program

7 0
3 years ago
Other questions:
  • Which category of app does word processing software fall into? A. Productivity B. Entertainment C. Social networking D. Educatio
    14·2 answers
  • What are the advantage of transistors over vacuum tubes?
    6·1 answer
  • What is wrong, logically, with the following code? if (x > 10) System.out.println("Large"); else if (x > 6 && x &l
    11·1 answer
  • The superclass Calculator contains: a protected double instance variable, accumulator, that contains the current value of the ca
    5·1 answer
  • Select the correct answer.
    6·1 answer
  • Which is true about POP3 and IMAP for incoming email?
    10·1 answer
  • What does it mean to clear a setting in a dialog box?
    14·1 answer
  • Can you install Ubuntu on a hard drive by porting from the folder to the HDD?
    10·1 answer
  • Which communication technology should you use if you need to connect three offices which are all within 3 miles of each other at
    6·1 answer
  • Please answer it’s timed
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!