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
Select all that apply. Backstage view will grant access to change which features?
dem82 [27]
Word Option and AutoCorrect

The office Backstage view is the one place that you can manage your data and files about them like saving, printing, creating, and setting options. It is everything that is done to a file and can be accessed when you first open your MS office and clicking on file tab. In the choices provided, both of these options selected can be found in the setting options of the backstage view.


6 0
3 years ago
6. When adjusting the bounding box around text, hold the key to scale
katrin2010 [14]

Answer:

What are the answers?

Explanation:

5 0
3 years ago
Please help it's my last question
Yuki888 [10]

Explanation:

here is your answer.. of. different between client / server architecture and peer to peer architecture of the network.

6 0
3 years ago
Read 2 more answers
Which is true regarding networks?
shutvik [7]
Local Are Network (LAN) is a network that connect computer (or other network devices) in a limited area (local area).
Wide Area Network (WAN) on the other hand is a network that connects computers on a a large geographical area. According these definitions, the following statement is true:
C) wide are network allow users to share files with a secure connection

4 0
4 years ago
Read 2 more answers
3) Paul enjoys working at Small World
BabaBlast [244]

Answer:

Environment

Explanation:

He finds the environment stimulating, hence why he enjoys working there.

3 0
3 years ago
Read 2 more answers
Other questions:
  • Extend the flow properties and definitions to the multiple-source, multiple- sink problem. Show that any flow in a multiple-sour
    13·1 answer
  • In __________ write, the data are stored in the cache, and control returns to the caller. Select one: a. a synchronous b. a buff
    8·1 answer
  • How do i get more coding programs
    14·2 answers
  • Which language would you use to create scripts that send data to a web server?
    12·2 answers
  • Each professional association has
    7·1 answer
  • Which of the following operating systems includes a virtual assistant?<br> Group of answer choices
    8·1 answer
  • Please explain a function in coding.
    8·1 answer
  • Why would students most likely need to collect data? Check all that apply
    13·2 answers
  • What has global css rulesets of an angular 8 project mcq.
    8·1 answer
  • The local Driver's License Office has asked you to write
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!