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
Alinara [238K]
3 years ago
10

Different between if/else structure and switchstructure in c and c++, why switch statements is more efficientthan using multiple

if/else statements?
Computers and Technology
1 answer:
ad-work [718]3 years ago
7 0

Answer:

Explanation:

Hello, great question. These types are questions are the beginning steps for learning more advanced Coding Problems.

If/Else statements receives an input and compares it to a true of false statement, if it is true then one function is called. Otherwise another function is called. IF/Else statements only have two outcomes which is why they are many times nested one on top of the other to be able to produce more outcomes.

Switch Statements receive and input and compares it to a set of predefined answers. If the right answer is found then the function relating to that answer is called. Otherwise the default function is called.

IF/Else is only more efficient than Switch statements if the inputted value is not predictable enough to make a predefined set.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

You might be interested in
To create a multiple-table form based on the âmanyâ table, tap or click the ____ button on the create tab to create a form in la
Archy [21]
Click on the blank form button. 
3 0
3 years ago
In this exercise, your function will receive 2 parameters, the name of a text file, and a list of strings. The function will wri
diamong [38]

Answer:

# the function is defined

# it takes 2 arguments: filename and list of string

def solution(filename, listOfString):

   # the file is opened in write mode

   # so that we can write to it

   with open(filename, 'w') as file_object:

       # we loop through the entire list of string

       # this looping help us know what to write to the file

       for each_string in listOfString:

           # if the length of the string is less than 4

           # we write 'x' with a new line

           if len(each_string) < 4:

               file_object.write("x\n")

           # else if the length of the string is greater than equals 4

           # we write the fourth character

           # and also add new line

           else:

               file_object.write(each_string[3])

               file_object.write("\n")

Explanation:

The function is written in Python. It takes two argument; filename and list of string.

It opens the file in write mode and then loop through the list of string. During the loop, we know what to write to the file.

In the length of a string is less than 4; we write 'x' else we write the fourth character in the string. The fourth character has an index of 3 because string uses zero index counting like a string. Starting from zero; 0, 1, 2, 3, 4... the fourth character has an index of 3.

5 0
3 years ago
How does the use of imagery create meaning
Contact [7]

Imagery is a feature of written and spoken language and occurs whenever someone has chosen to use language in a non-literal way.

Imagery is a way of describing something symbolically, using words to create a picture in the reader's imagination.

In the Close Reading paper you need to be able to recognise imagery and to consider how successful the imagery is at conveying to you what the writer is trying to express. Imagery frequently conveys more than just meaning. It is used to heighten the effect of language and is often an extension of word-choice. Normally an image will extend to a phrase or a few words but sometimes it will be longer. The simplest form of imagery to recognise is when something or someone is compared to something else, with the purpose of establishing some parallel between the two. Images of this kind frequently concern qualities like beauty, speed, force, power and natural and animal traits.

6 0
3 years ago
Read 2 more answers
The navigation bar appears in the same position on each page and uses the same colors, fonts, and font styles.
Ivan

Answer:

true

Explanation:

I think that's what it has been in my time of classes

3 0
3 years ago
Controlling inflation is the job of the __________________.
n200080 [17]
B. Federal Reserve................
8 0
3 years ago
Read 2 more answers
Other questions:
  • Let PALINDROME_DFA= | M is a DFA, and for all s ∈ L(M), s is a palindrome}. Show that PALINDROME_DFA ∈ P by providing an algorit
    5·1 answer
  • Using a wireless network without the network owner's permission is known as ________.
    15·1 answer
  • Will give brainliest!!!!!!!!!!!!
    6·2 answers
  • Joshua takes ownership of all his tasks. Which quality is he demonstrating?
    9·2 answers
  • How many 16ths are in 3/8 of an inch
    12·1 answer
  • The calculation of the likelihood of an attack coupled with the attack frequency to determine the expected number of losses with
    12·1 answer
  • Connect 5 LEDs with any random colors. Iteratively, turn ON 1 to 5 LED(s) that will take 5 iterations in total, and in every ite
    6·1 answer
  • ____ returns the maximum number of elements that can be inserted into the vector container vecCont without reallocation.
    9·1 answer
  • Write a simple algorithm in pseudocode that asks the user their favourite colour and then agrees with their choice, quoting the
    15·1 answer
  • Drag each tile to the correct box.
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!