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]
2 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]2 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
How many check boxes from the following code can be selected at any given time? Home Address Federal Express UPS
Ahat [919]

Answer:

The answer to the given question is "3".

Explanation:

  • In the given HTML checkboxes code. We used input type= "checkbox" that provide a checkbox. That is used to select one or more options on the limited number of choices.  
  • In this code, we use check three checkbox that is "Home Address, Federal Express and UPS" in this checkboxes code we use the name attribute that works as a reference this attribute is used to submit data into the database.  

In this code, we select(check) in all three checkboxes that's why the answer to this question is "3".

5 0
2 years ago
What is data protection
Fiesta28 [93]
Legal safeguards to prevent misuse of information stored on computers, particularly information about individual people.             In other terms it is security for personal information.
3 0
3 years ago
Write a program to compute the maximum and minimum value of three numbers:
nexus9112 [7]

Answer:

in javascript:

function compute(a, b, c){

let array = [a, b, c];

array.forEach((e,k) => {

if(e >= a && e >= b && e >= c){

console.log("maximum: " + e);

}  

if( e <= a && e <= b && e <= c){

console.log("minimum: " + e);

}

}

}

Explanation:

7 0
3 years ago
write a function that given an integer Y and 3 non-empty string A,B,W, denotingthe year of vacations, the beginning month, the e
chubhunter [2.5K]

Answer:un spain please

Explanation:

4 0
3 years ago
What are the main types of reading tools? Check all that apply. please HELP​
vovangra [49]

Answer:

Comprehension

reference

3 0
2 years ago
Other questions:
  • Artists who draw images on a computer often use a stylus in conjunction with special _________ tablets, which offer extra-sensit
    15·1 answer
  • Write an examples of Output device, storage devices and inputs device 10 each excluding the common ones​
    5·1 answer
  • In these weeks readings, we learned about the CIA Triad and how each exhibits dependence on the other. Give examples of how fail
    12·1 answer
  • The level of competition is an important factor for many people when selecting a physical activity.
    7·2 answers
  • Using underlining and italics at the same time is which of these? A. allowed but might be overkill B. always a good idea C. not
    15·2 answers
  • What is a example of blockchain
    8·1 answer
  • Generally speaking, problems are rarely caused by motherboards. However, there are some instances in which a motherboard can fai
    12·1 answer
  • Swapping two input integers if they are not the same. (use switch-case
    10·1 answer
  • The underlying color of a slide.
    9·1 answer
  • Due TODAY!!! Can someone please help me!!!
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!