Why do we use functions?
To stop the program from repeating.
To test for true and false.
To simplify code.
To ask the user for input.

Answers

Answer 1
to stop the program from repeating :)
Answer 2
To stop the program from repeating. That is the answer

Related Questions

Write a program second.cpp that takes in a sequence of integers, and prints the second largest number and the second smallest number. Note that in the case of repeated numbers, we really mean the second largest and smallest out of the distinct numbers (as seen in the examples below). You may only use the headers: and . Please have the output formatted exactly like the following examples: (the red is user input)

Answers

Answer:

The program in C++ is as follows:

#include <iostream>

#include <vector>

using namespace std;

int main(){

   int n;

   cout<<"Elements: ";

   cin>>n;

   vector <int>num;

   int input;

   for (int i = 1; i <= n; i++){        cin>>input;        num.push_back(input);    }

   int large, seclarge;

   large = num.at(0);      seclarge = num.at(1);

  if(num.at(0)<num.at(1)){     large = num.at(1);  seclarge = num.at(0);   }

  for (int i = 2; i< n ; i ++) {

     if (num.at(i) > large) {

        seclarge = large;;

        large = num.at(i);

     }

     else if (num.at(i) > seclarge && num.at(i) != large) {

        seclarge = num.at(i);

     }

  }

  cout<<"Second Largest: "<<seclarge<<endl;

  int small, secsmall;

  small = num.at(1);       secsmall = num.at(0);

  if(num.at(0)<num.at(1)){ small = num.at(0);  secsmall = num.at(1);   }

  for(int i=0; i<n; i++) {

     if(small>num.at(i)) {  

        secsmall = small;

        small = num.at(i);

     }

     else if(num.at(i) < secsmall){

        secsmall = num.at(i);

     }

  }

  cout<<"Second Smallest: "<<secsmall;

  return 0;

}

Explanation:

See attachment for explanation

state two ways of moving an icon from one location to another​

Answers

Answer:

To arrange icons by name, type, date, or size, right-click a blank area on the desktop, and then click Arrange Icons.

Click the command that indicates how you want to arrange the icons (by Name, by Type, and so on).

If you want the icons to be automatically arranged, click Auto Arrange.

If you want to arrange the icons on your own, click Auto Arrange to remove the check mark.

Explanation:

How to use the RANK Function in Microsoft Excel

Answers

Answer:

=RANK (number, ref, [order])

See Explanation

Explanation:

Literally, the rank function is used to rank values (i.e. cells) in a particular order (either ascending or descending).

Take the following instances:

A column used for total sales can use rank function to rank its cells from top sales to least.

A cell used for time can also use the rank function to rank its cells from the fastest time to slowest.

The syntax of the rank function is:

=RANK (number, ref, [order])

Which means:

[tex]number \to[/tex] The rank number

[tex]ref \to[/tex] The range of cells to rank

[tex]order \to[/tex] The order of ranking i.e. ascending or descending. This is optional.

Line 9 and 10
To calculate your taxable income, subtract the sum of lines 8
and 9 from line 7, and then enter that number here.

Answers

Answer:

22,332

Explanation:

The taxable income :

Line 8 = Standard deduction or itemized deduction

Line 9 = Qualified business income deduction

Line 7 = Adjusted gross income

Taxable income = Adjusted gross income - (Qualified business income deduction + standard deduction)

Taxable income = 34732 - (12400 + 0)

Taxable income = 34732 - 12400

Taxable income = 22,332

Write a class named Employee that has private data members for an employee's name, ID_number, salary, and email_address. It should have an init method that takes four values and uses them to initialize the data members. It should have get methods named get_name, get_ID_number, get_salary, and get_email_address. Write a separate function (not part of the Employee class) named make_employee_dict that takes as parameters a list of names, a list of ID numbers, a list of salaries and a list of email addresses (which are all the same length). The function should take the first value of each list and use them to create an Employee object. It should do the same with the second value of each list, etc. to the end of the lists. As it creates these objects, it should add them to a dictionary, where the key is the ID number and the value for that key is the whole Employee object. The function should return the resulting dictionary. For example, it could be used l

Answers

Solution :

class Employee:

   #Define the

   #constructor.

   def __[tex]$\text{init}$[/tex]__([tex]$\text{self, nam}e$[/tex],  ID_number, [tex]$\text{salary}$[/tex], email):

       #Set the values of

       #the data members of the class.

       [tex]$\text{self.nam}e$[/tex] = name

       [tex]$\text{self.ID}$[/tex]_number = ID_number

       [tex]$\text{self.salary}$[/tex] = salary

       self.email_address = email

#Define the function

#make_employee_dict().

def make_employee_dict(list_names, list_ID, list_salary, list_email):

   #Define the dictionary

   #to store the results.

   employee_dict = {}

   #Store the length

   #of the list.

   list_len = len(list_ID)

   #Run the loop to

   #traverse the list.

   for i in range(list_len):

       #Access the lists to

       #get the required details.

       name = list_names[i]

       id_num = list_ID[i]

       salary = list_salary[i]

       email = list_email[i]

       #Define the employee

       #object and store

       #it in the dictionary.

       employee_dict[id_num] = Employee(name, id_num, salary, email)

   #Return the

   #resultant dictionary.

   return employee_dict

In this lab, you use what you have learned about searching an array to find an exact match to complete a partially prewritten C program. The program uses an array that contains valid names for 10 cities in Michigan. You ask the user to enter a city name; your program then searches the array for that city name. If it is not found, the program should print a message that informs the user the city name is not found in the list of valid cities in Michigan. The file provided for this lab includes the input statements and the necessary variable declarations. You need to use a loop to examine all the items in the array and test for a match. You also need to set a flag if there is a match and then test the flag variable to determine if you should print the the Not a city in Michigan. message. Comments in the code tell you where to write your statements. You can use the previous Mail Order program as a guide. Instructions Ensure the provided code file named MichiganCities.cpp is open. Study the prewritten code to make sure you understand it. Write a loop statement that examines the names of cities stored in the array. Write code that tests for a match. Write code that, when appropriate, prints the message Not a city in Michigan.. Execute the program by clicking the Run button at the bottom of the screen. Use the following as input: Chicago Brooklyn Watervliet Acme

Answers

Answer:

Complete the program as follows:

for(int i = 0; i<10; i++){

     if(inCity == citiesInMichigan[i]){

         foundIt = true;

         break;       }    }

   if(foundIt){         cout<<"It is a city";     }

   else{         cout<<"Not a city";     }

Explanation:

Required

Complete the pre-written code in C++ (as indicated by the file name)

The pre-written code; though missing in this question, can be found online.

The explanation of the added lines of code is as follows:

This iterates through the array

for(int i = 0; i<10; i++){

This checks if the city exists in the array

     if(inCity == citiesInMichigan[i]){

If yes, foundIt is updated to true

         foundIt = true;

And the loop is exited

         break;       }    } -- The loop ends here

If foundIt is true, print it is a city

   if(foundIt){         cout<<"It is a city";     }

Print not a city, if otherwise

   else{         cout<<"Not a city";     }

// MichiganCities.cpp - This program prints a message for invalid cities in Michigan.// Input: Interactive// Output: Error message or nothing#include <iostream>#include <string>using namespace std;int main(){ // Declare variables string inCity; // name of city to look up in array const int NUM_CITIES = 10; // Initialized array of cities string citiesInMichigan[] = {"Acme", "Albion", "Detroit", "Watervliet", "Coloma", "Saginaw", "Richland", "Glenn", "Midland", "Brooklyn"}; bool foundIt = false; // Flag variable int x; // Loop control variable // Get user input cout << "Enter name of city: "; cin >> inCity; // Write your loop here for (x = 0; x < NUM_CITIES; x++) { // Write your test statement here to see if there is // a match. Set the flag to true if city is found. if (inCity == citiesInMichigan[x]) { foundIt = true; cout << "City found." << endl; break; } else { foundIt = false; } } // Test to see if city was not found to determine if // "Not a city in Michigan" message should be printed. if (!foundIt) { cout << "Not a city in Michigan." << endl; } return 0; } // End of main()

pleaseeeeeeee tellllllllllllllllllllll​

Answers

Answer:

true is the correct answer

it is a group of two or more computer system connect to each other​

Answers

network is a group of two or more computer system connected together

Write functions to compute a subset, find member, union, and intersection of sets. Follow the steps below:

1. Read two integers from the user.
2. Suppose one of the integers is 2311062158. The binary equivalent of this integer stored in a register will be 1000 1001 1100 0000 0000 0010 1000 1110. This data should be regarded as bit strings representing subsets of the set {1, 2, … 32}. If the bit string has a 1 in position i, then element i is included in the subset. Therefore, the string: 1000 1001 1100 0000 0000 0010 1000 1110 corresponds to the set: {2, 3, 4, 8, 10, 23, 24, 25, 28, 32}.
3. Print out members of the set from smaller to larger. You can do a loop from 1 to 32. Load a masking bit pattern that corresponded to the position number of the loop counter (0x00000001 for 1). Isolate the bit in the operand by using the AND operation. If the result of the AND is not 0 then the loop counter is in the set and should be displayed. Increment the counter and shift the masking bit pattern to the left.
4. Read a number from the user. Determine if that element is a member of the given sets.
5. Determine the union of two sets.
6. Determine the intersection of two sets.
7. Implement a loop back to the main function. See the prompts below: "Enter the first number:" "Enter the second number:" "Members of Set 1:" "Members of Set 2:" "Enter an element to find:" "It is a member/ not a member of set 1" "It is a member/ not a member of set 2" "Union of the sets:" "Intersection of the sets:" "Do you want to compute set functions again?"
8. Test the program using the following data:

Enter the first number: 99999
Enter the second number: 111445
Members of set 1: 1 2 3 4 5 8 10 11 16 17
Members of set 2: 1 3 5 7 9 10 13 14 16 17
Enter an element to find: 7
It is not a member of set 1
It is a member of set 2
Union of the sets: 1 2 3 4 5 7 8 9 10 11 13 14 16 17
Intersection of the sets: 1 3 5 10 16 17

Answers

Explanation:

Suppose one of the integers is 2311062158. The binary equivalent of this integer stored in a register will be 1000 1001 1100 0000 0000 0010 1000 1110. This data should be regarded as bit strings representing subsets of the set {1, 2, … 32}. If the bit string has a 1 in position i, then element i is included in the subset. Therefore, the string: 1000 1001 1100 0000 0000 0010 1000 1110 corresponds to the set: {2, 3, 4, 8, 10, 23, 24, 25, 28, 32}.

Given positive integer n, write a for loop that outputs the even numbers from n down to 0. If n is odd, start with the next lower even number.

Answers

Answer:

if(n % 2 == 0){

   for(int i = n; i >= 0; i-=2){

        System.out.println(i);

    }

}

else{

     for(int i = n - 1; i >= 0; i-=2){

        System.out.println(i);

     }

}

Sample output

Output when n = 12

12

10

8

6

4

2

0

Output when n = 21

20

18

16

14

12

10

8

6

4

2

0

Explanation:

The above code is written in Java.

The if block checks if n is even by finding the modulus/remainder of n with 2.  If the remainder is 0, then n is even. If n is even, then the for loop starts at i = n. At each cycle of the loop, the value of i is reduced by 2 and the value is outputted to the console.

If n is odd, then the else block is executed. In this case, the for loop starts at i = n - 1 which is the next lower even number. At each cycle of the loop, the value of i is reduced by 2 and the value is outputted to the console.

Sample outputs for given values of n have been provided above.

Choose the item which best describes the free frame list. 1. a per process data structure of available physical memory 2. a global data structure of available logical memory 3. a global data structure of available physical memory 4. a global data structure of available secondary disk space

Answers

Answer:

A global data structure of available logical memory ( Option 2 )

Explanation:

A Free list is a data structure connecting unallotted regions in a memory together in a linked list (scheme for dynamic/logical memory allocation) , hence a free frame list is a global data structure of available Logical memory .

pleaseeeeeeee tellllllllllllllllllllll​

Answers

Answer:

hey

Explanation:

I hope is helpful

Mark mi brilliant plzz

(FORMAL FEEDBACK )IS YOUR ANSWER

1. A bank customer invested $24 in a bank with 5 percent simple interest per year, write a program the construct a table showing how much money the bank customer would have at the end of each 20- year period starting in 2021 to 2041.

2. A programmer starts with salary of $65,000 and expect to receive $1500 raise each year. Write a program to compute and print the programmer's salary for each of the first 10 years and total amount of money the programmer would receive over the 10- year period.

Answers

Answer:

1.lettuce is 2021 to 2,000 4136 verse 2. that is 10 years to tell if your 10 years 20 years old point month

Which of the following describes a characteristic of organic light-emitting diodes (OLEDs) used in clothing?

uniform

flexible

transparent

sizeable

Answers

Flexible

Hopes this helps!

Answer:

Yes the answer is flexible.

Explanation:

I took the test and got it right.

Which of the following are examples of nontoxic materials used in computer equipment?
gold, silver, copper
arsenic, copper, gold
dioxin, silver, gold
copper, silver, lead

Answers

Answer: Gold, Silver, Copper

Explanation:

Gold is very useful in computers as it can be used for connectors, connecting wires and even memory chips. It is a nonreactive metal and so is not toxic unless it is consumed (and in large quantities).

Silver is another nontoxic metal used in computers to make circuit boards, cellphones and even keyboard components. Finally there is the very important copper which is a useful electronic component for more than just computers. This non-toxic metal has contributed significantly to the development of many things electrical including, as already mentioned, computers.

InfoTrac is an aggregated database?

True

False

Answers

Answer: true

Explanation:

public class Square extends Shape{
/**Like with Shape, we will be making a static instance variable
* to keep track of how many squares we have made. It is very
* similar to the one in shape, and it's uses are similar as well.
* It too is initialized to zero.
*
* We may also need additional instance variables, which you should
* declare as needed. They will not need to be static nor initialized
* here though.
**/
/**You may need additional instance variables. Declare them here.
**/
/**The constructor for Square is a little more involved than the
* Shape constructor, as it takes a single double parameter representing
* the side length. It should also call the super constructor, as
* calling it increments the number of shapes made, which we should
* do (as a Square extends Shape). We also need to increment the
* instance variable representing the number of squares made, and handle
* our parameter appropriately.
**/
public Square(double sideLength){
}
/**Like with our other shapes, this is a simple getter method for our
* static instance variable.
**/ public static int getNumSquaresMade(){
return -1;
}
/**As always, we must override getSize() for our Square. A Square's size
* is simply it's side length squared.
**/
}
public class Shape{
private static int numShapesMade = 0;
public Shape(){
numShapesMade++;
}
public static int getNumShapesMade(){
return numShapesMade;
}
public double getSize(){
return 0;
}
}

Answers

Answer:

I would say A

Explanation:

Enjoy :)

list eight applications software​

Answers

Answer:

Eight applications software are:

Word processing softwareSpreadsheet software Graphics software Database software Web browser softwareAnimation softwareInternet browser softwares like: fire fox, chrome etcPresentation software

In Python what are the values passed into functions as input called?

Answers

formal parameter or actual parameter i think

what functions can you perform with project management software?

Answers

Answer:

Planning and scheduling. ...

Collaboration. ...

Documentation. ...

Reporting. ...

Resource management. ...

Managing the project budget.

Explanation:

Please answer it’s timed

Answers

Product safety cuz it talking about safety

Answer:

product safety

Explanation:

brainly:)^


Landing pages in a foreign language should never be rated fully meets?

Answers

Answer:

if the landing page provides all kind information of information as to that site people usually like it or will most likely enjoy it

BRAINLIEST?????

Explanation:

A pharmaceutical company is going to issue new ID codes to its employees. Each code will have three letters followed by one digit. The letters and and the digits , , , and will not be used. So, there are letters and digits that will be used. Assume that the letters can be repeated. How many employee ID codes can be generated

Answers

Answer:

82,944 = total possible ID's

Explanation:

In order to find the total number of combinations possible we need to multiply the possible choices of each value in the ID with the possible choices of the other values. Since the ID has 3 letters and 1 digit, and each letter has 24 possible choices while the digit has 6 possible values then we would need to make the following calculation...

24 * 24 * 24 * 6 = total possible ID's

82,944 = total possible ID's

Popular periodicals might include newspapers

True or false?

Answers

Answer:

False

Explanation:

Because there is no way that would be correct!

Answer:

True

Explanation:

It makes sense

~Plz tap the crown ~

~Thank you~

What allows you to navigate up down left and right in a spreadsheet?

Answers

Answer:

scrollbar?

Explanation:

____________

Code a Python program that uses a graphical user interface (GUI) to address a real-world problem. Within reason, you may choose to address any real-world problem that you would like; however, please only choose a real-world problem that is both safe and legal.

Answers

Answer:

Explanation:

The following is a simple GUI Python program that solves for the different variables in a Pythagorean theorem equation, which is a real-world problem that many students have to face on a daily basis. The output can be seen in the attached picture below. Due to technical difficulties, I have added the code as a txt file attachment.

Plzz help will mark brainliest

Answers

Answer:

11. 3 dimensions

12. ( i believe its number 3)

13. 2 option

14. Natural Light

15. Development

Explanation:

What is the first step you should take when you want to open a savings account? A. Present your photo ID to the bank representative. B. Go to the bank and fill out an application. C. Make your initial deposit. D. Review the different savings account options that your blunk offers.​

Answers

Answer: B

Explanation:

The first step you should take when you want to open a savings account is the photo id

pleaseeeeeeee tellllllllllllllllllllll​

Answers

Answer:

visual communication

hope it helps

stay safe healthy and happy.

Answer:

visual communication will be the correct answer

state 4 basic operation performed by a computer​

Answers

Answer:

The processes are input, output, storing,processing, and controlling.

input, processing, output, and storage.
Other Questions
What is the event that brought the Era of Good Feelings to an end what is the value of 3^3 + 7(2x -6), when x=4? bakit mahalaga sa buhay ng tao ang may karamay Which of the following groups of people be the least affected by air pollution? Lexi is hiking a trail that is 7.5 miles long. She stops to take a break after hiking 3.8 miles of the trail. Which equation can be used to find how many miles, m, Lexi has left to hike May I have help on this? I am confused! :( what is the process of reproduction between human and animals? Find the trig function and simplify if you can A zip line starts on a platform that is 40 meters above the ground. The anchor for the zip line is 198 horizontal meters from the base of the platform. How long is the zip line? help grifjin In 1981, the United States experienced an oil bust largely due toA. an increase in the price of oil and a decrease in the availability of foreign oilB. a decrease in the price of oil and an excessive amount of domestic oilC. an increase in the price of oil and an increase in the amount of domestic oilD a decrease in the price of oil and a limited supply of foreign and domestic oilIts b (b) Increase 150 by 25% Sort each power into the category where it fits best.recognizing nationsmilitary powersdiplomatic powersexecutive powerssigning legislationgranting pardonsnominating officialsleading the armed forcesmaking treaties 1. In its first three centuries, Russia could be called a multinationalempire for what reason?A) It attempted to simulate European culture.B) It occupied areas of many different ethnicities.C) It was significantly larger than other countries.D) It was an absolutist government ran by the Romanovs. g(x)=4x^2what would be the table to graph? A student rubs a rubber balloon on their hair for several seconds. The student then rubs a second rubber balloon on her hair for the same length of time. The student determines that the first rubber balloon is repelled by the second rubber balloon, but the first rubber balloon is attracted to her hair. Which of the following claims, with appropriate evidence, if any, supports the notion of the two- charge model? Justify your selection. A. The first rubber balloon is repelled by the second rubber balloon, but the first rubber balloon is attracted to the hair. These results show that two charges must exist because certain combinations of charges attract and certain combinations of charges repel. B. The first rubber balloon is repelled by the second rubber balloon. This result shows that the charge of both objects must have the same sign. C. The first rubber balloon is attracted to the hair. This result shows that the charge of both objects must be opposite in sign. D. None of the claims nor evidence support the notion of the two-charge model. Which of the following shows the solution to m + 5 > -1? Read the sentence below and answer the question that follows.Each economic sector plays a vital role in a nation's economy.The word underlined in the sentence above is best defined asA decisionB. activityC. dollarD. part Rock, Paper, ScissorsIn this unit, you expanded your Python skills, and now you can really have some fun! In this lab, you are going to create a game that allows the user to play Rock, Paper, Scissors against the computer. If you arent familiar with this classic game, heres how it works: two people (or a person and a computer!) each select either rock, paper, or scissors. The player who chooses the stronger object wins. Here is how the winner is determined:Rock beats scissors because a rock can break scissors.Paper beats rock because paper can cover a rock.Scissors beats paper because scissors can cut paper.Go to https://repl.it/ to write your program.Your program should do the following:Randomly choose rock, paper, or scissors for the computerAsk the user to choose rock, paper, or scissorsCompare the computers choice to the players choiceAnnounce whether the computer or the human wonHere are two hints to help you write this program:Test parts of your program to see if they work before moving on to work on other parts. For example, you will need to have the computer select a random number and then choose for that number to correspond to rock, paper, or scissors. You can write just that portion of the program and then test it by having the program print the word rock, paper, or scissors before you even begin working on the part of the program where the user inputs their choice. (Of course, dont forget to erase the line of code that prints the computers choice when you are finished testingotherwise the game will be just a bit too easy for the user!)On a piece of paper, draw a chart that shows all nine possible outcomes of the game and use that chart to design and test the program. The chart might look like this:TABLE 1 Rock paper scissors outcomes Computer chooses rock Computer chooses paper Computer chooses scissorsUser chooses rockTied gameComputer winsUser winsUser chooses paperUser chooses scissorsRun several tests on your program to be sure that the correct winner is announced.When your program works properly, take a screenshot of your code to turn in. which is the following is most clearly an example of dialogue if sin= 3/4 what are the values of cos 0 and tan 0