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
Ainat [17]
4 years ago
13

Write the definition of a function printAttitude , which hasan int parameter and returns nothing. The function prints amessage t

o standard output depending on the value of itsparameter.a.If the parameter equals 1, the function prints disagree.b.If the parameter equals 2, the function prints no opinion.c.If the parameter equals 3, the function prints agree.d.In the case of other values, the function does nothing.
Computers and Technology
1 answer:
erastova [34]4 years ago
6 0

Answer:

The function definition to this question can be given as:

Function definition:

void printAttitude(int x1) //define function printAttitude.

{

//nested else-if statements

if(x1==1)

 //if block

cout<<"disagree"<<endl;

//message

else if(x1==2)

 //else if block  

cout<<"no opinion"<<endl;

//message

else if(x1==3)

 //else if block

cout<<"agree"<<endl;

//message

else

cout<<" ";

}

Explanation:

In the above method definition firstly, we define a method that is "printAttitude". In this method, we pass an integer variable that is "x1". This function does not return any value because its return type is void. In this method, we use nested else-if statements. The description of these conditions can be given as:

  • In the if block we check the variable x1 value is equal to 1 If this condition is true. It will print "disagree" otherwise it will go to else-if block.  
  • In the else-if block, we check the variable x1 value is equal to 2 if the condition is true. It will print "no opinion". otherwise, we will go to another else-if block.
  • In this block, we check the variable x1 value is equal to 3 if this condition is true. It will print "agree".otherwise it will go to else block.
  • In the else block it will print nothing.
You might be interested in
The volume of a sphere is 4/3πr3, where π has the value of "pi". Write a function called print_volume (r) that takes an argument
Marizza181 [45]

Answer:

In Python:

def print_volume (r):

   volume = 4/3 * 3.142*r**3

   print(volume)

print_volume(7)

print_volume(14)

print_volume(22)

Explanation:

This defines the function and takes radius r as the parameter

def print_volume (r):

This calculates the volume

   volume = 4/3 * 3.142*r**3

This prints the volume

   print(volume)

The next three lines call the function with different values

<em>print_volume(7)</em>

<em>print_volume(14)</em>

<em>print_volume(22)</em>

6 0
3 years ago
How many bits are necessary for a binary representation (unsigned) of:
pshichka [43]

Answer:

Hi!

The answer to:

a. 6 bits.

b. 9 bits.

c. 26 bits.

Explanation:

a. For the states of the U.S.A, you need 50 or more combinations to represents each element.

<u>If you use 6 bits, the possible combinations are 2⁶ = 64.  </u>

b. For days in a year, you need 365 or more combinations to represents each element.

<u>If you use 9 bits, the possible combinations are 2⁹ = 512. </u>

c. For inhabitants of California, you need 36,457,549 or more combinations to represents each element.

<u>If you use 26 bits, the possible combinations are 2²⁶ = 67,108,864.</u> If you use 25 bits instead of 26, then you have 2²⁵ = 33,554,432 combinations. These possible combinations are not enough to represent each inhabitant.

4 0
3 years ago
A = [2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 33 34 35 36 37 38 39 40]
vova2212 [387]

Answer:

C = a./b

Explanation:

In MATLAB, the following command:

C = A./B

Performs the element by elemet division of A and B. This comand is called Right-array division.

So, in your case, we could divide A by B element by element, only using fully-vectorised code (ie. no loops), with the following code:

a = [2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 33 34 35 36 37 38 39 40];b = [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 43 45 47 49 50 54 59 60];C = a./b;

C would be the element by element division of A and B, with no loops.

5 0
3 years ago
Write qbasic code for given pattern<br><br>NEPAL<br>. EPA<br>. P​
V125BC [204]

Answer:

The program to question as follows:

Program:

PRINT "NEPAL", 'print message

PRINT ".EPA", 'print message

PRINT ".P​", 'print message

Output:

NEPAL  

.EPA  

.P​

Explanation:

In the above Qbasic program code, the three print function will be used to print the given pattern, that can be described as follows:

  • The first time the print function is used, which uses a value, that is "NEPAL" to print its value.
  • In the second time, again this function is used, that prints a value, that is ".EPA".
  • In the last time, the print method accepts a value, which is ".P" to print its value. when the code is executed, it will print the given design.
3 0
3 years ago
During flashbacks you experience______.
Alina [70]
During flashbacks you see what happened in the past.
8 0
3 years ago
Read 2 more answers
Other questions:
  • Which is NOT a type of SD card?
    8·2 answers
  • What is required to display content on transparencies?
    6·1 answer
  • Which of the following for-loop headers results in equivalent numbers of iterations: A. for (int q = 1; q &lt;= 100; q++) B. for
    12·1 answer
  • ¿Que es una linea del tiempo?
    8·1 answer
  • What is the statement describing? Agile team continuously adapt to new circumstances and enhance the methods of value delivery
    6·1 answer
  • A use case description is the best place to start for the design of the forms for a user interface.​ True False
    15·1 answer
  • In workstation domain policies, _________________ provide the specific technology requirements for each device. IT staff uses re
    9·1 answer
  • What is first page of website called​
    10·1 answer
  • The instructions in a program ...
    9·1 answer
  • Which structures protect the cell? Select two options.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!