Write a loop that sets each vector element to the sum of itself and the next element, except for the last element which stays the same. Be careful not to index beyond the last element. Ex:Initial scores: 10, 20, 30, 40Scores after the loop: 30, 50, 70, 40The first element is 30 or 10 + 20, the second element is 50 or 20 + 30, and the third element is 70 or 30 + 40. The last element remains the same. Sample program:#include #include using namespace std;int main() { const int SCORES_SIZE = 4; vector bonusScores(SCORES_SIZE); int i = 0; bonusScores.at(0) = 10; bonusScores.at(1) = 20; bonusScores.at(2) = 30; bonusScores.at(3) = 40; for (i = 0; i < SCORES_SIZE; ++i) { cout << bonusScores.at(i) << " "; } cout << endl; return 0;}

Answers

Answer 1

Answer:

Add the following lines of code to the already existing code segment

for (i = 0; i < SCORES_SIZE-1; ++i) {

       bonusScores.at(i) = bonusScores.at(i) + bonusScores.at(i+1);

 }

Explanation:

To do the task in the question, we have to iterate through the vector from the first element i.e. element at index 0 to the second to the last element; i.e. element at last index - 1

We then add each element in this iteration with the next.

This iterates through the vector from 0 to SCORES_SIZE - 1

for (i = 0; i < SCORES_SIZE-1; ++i) {

This adds each vector element with the next

       bonusScores.at(i) = bonusScores.at(i) + bonusScores.at(i+1);

 }

The above should be added before

for (i = 0; i < SCORES_SIZE; ++i) {

       cout << bonusScores.at(i) << " ";

}

Also, I've made other modifications to the program.

Proper import of header filesProper declaration of vector bonusScores

See attachment for complete source code


Related Questions

Write a function named cube that accepts a number as an argument and returns the cube of that number. Write Python statement(s) that passes 3 to this function and prints returned value.​

Answers

def cube(num):

   return num*num*num

for the number 3:

def cube():

    return 3*3*3

A ____________ monitor measures the usage of a cloud-based IT resource by a given cloud consumer for billing purposes.

Answers

Answer:

pay-per-use monitor

Explanation:

The pay-per-use monitor mechanism can be described as a measurement of cloud-based IT resource usage which are in line with already defined pricing parameters and which can generate usage logs which are used for the calculations of accumulated fees calculations and are also used for billing purposes. This service uses models that are subscription based and also consumption based.

Need help with 4.7 lesson practice

Answers

Answer: Question 1 is A  Question 2 is C

Explanation:

What is Gpu in simple terms ​

Answers

Graphic processing unit !!?????!!??!??!?!!?!!?

Answer: Graphics processing unit (GPU)

Explanation: It is a specialized electronic circuit designed to rapidly manipulate and alter memory to accelerate the creation of images in a frame buffer intended for output to a display device. GPUs are used in embedded systems, mobile phones, personal computers, workstations, and game consoles.

which of the following file formats cannot be imported using Get & Transform?

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

In this question, the given options are:

A.) Access Data table

B.)CVS

C.)HTML

D.)MP3

The correct option to this question is D- MP3.

Because all other options can be imported using the Get statement and can be further transformed into meaningful information. But MP3 can not be imported using the GET statement and for further Transformation.

As you know that the GET statement is used to get data from the file and do further processing and transformation.

Write a loop that fills an array int values[10] with ten random numbers between 1 and 100. Write code for two nested loops that fill values with ten different random numbers between 1 and 100.

Answers

Answer:

#include <iostream>

#include <cstdlib>

using namespace std;

int main() {

   int[] array = new int[10];

   int index = 0;

   while(index < array.size()){

           int number = (rand() % 100) + 1;

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

               array[index] = number;

               cout<< "Position "<< index << "of the array = "<< number << endl;

               ++index;

           }

     }

}

Explanation:

The while loop in the source code loops over a set of code ten times, The for loop only loops once to add the generated random number between 1 and 100 to the array of size 10. At the end of the for loop, the index location and the item of the array is printed out on the screen. The random number is generated from the 'rand()' function of the C++ standard library.

In programming languages, ____ is used as a mnemonic representation for the program instruction’s memory address.

Answers

Answer:

Assembly language

Explanation:

Assembly language writes instructions in human letters. Every machine language instruction has a corresponding assembly language instruction that means exactly the same thing. Assembly language uses a symbolic form of a program which are capable of:

- readable by human beings (+/-)

- constants, addresses, and names of symbolic instructions

- arithmetic during assembly - calculations of addresses, constants

- synthetic instructions (not supported by our assembler)

- expansion of macroinstructions (not supported by our

assembler)

- assembly instructions (pseudo-instructions)

• memory allocation

• memory initialization

• conditional assembly (not supported by our assembler)

An 8-bit ADC has an input range of 0 to 10 volts and an output range of 0 to 255 (called straight binary). What digital value will be returned when an input of 7.5 volts is sampled?

Answers

Answer:

converting 191.25 to Binary 110011

Explanation:

Input range = 0 to 10volts

output range = 0 to 255

first we have to determine the resolution

= output range / input range

= 255 -0 / 10 - 0

= 25.5

when an input value of 7.5 volts is sampled

digital equivalent o/p voltage = 7.5 * 25.5

                               = 191.25

converting 191.25 to Binary 110011

Write a public static method named evens that takes in 1 argument int a, and returns a String containing all positive even numbers with each separated by a comma from O up to that number inclusive if it is also even
Remember if the argument is odd not to include it in the output
Remember there should be no trailing comma after the values
If the argument a is negative return a String that says "NONE!
(Do not print the String)
Example evens(5) String returned by method. 0.2.4
Example evens(8) String returned by method. 0.2.4,6,8
Example evens (9) String returned by method 0.246,8
Example evens(-5), String returned by method: NONE
Example evens(O) String retumed by method 0
Example evens(1) String returned by method 0

Answers

public class JavaApplication48 {

   public static String evens(int a){

       String txt = "";

       if (a < 0){

           return "NONE!";

       }

       else if(a%2 == 1){

           a -= 1;

       }

       for (int i = 0; i <= a; i+=2){

           if (i < a){

               txt += i+",";

                       }

           else{

               txt += i;

           }

       }

       return txt;

   }

   public static void main(String[] args) {

       System.out.println(evens(1));

   }

   

}

I hope this helps!

The public static method named evens that takes in 1 argument int a, and returns a String containing all positive even numbers with each separated by a comma is in explanation part.

What is programming?

The process of creating a set of instructions that tells a computer how to perform a task is known as programming.

Here's a possible implementation in Java:

public static String evens(int a) {

   if (a < 0) {

       return "NONE!";

   }

   StringBuilder result = new StringBuilder();

   for (int i = 0; i <= a; i += 2) {

       if (i > 0) {

           result.append(",");

       }

       result.append(i);

   }

   return result.toString();

}

Thus, this method first checks if the argument is negative, and if so, returns the String "NONE!".

For more details regarding programming, visit:

https://brainly.com/question/11023419

#SPJ2

Java: Programming Question: Reverse OrderWrite a program that reads ten integers into an array; define another array to save those ten numbers in the reverse order. Display the original array and new array. Then define two separate methods to compute the maximum number and minimum number of the array.Sample Run:Please enter 10 numbers: 1 3 5 8 2 -7 6 100 34 20The new array is: 20 34 100 6 -7 2 8 5 3 1The maximum is: 100The minimum is: -7Bonus: Determine how many numbers are above or equal to the average and how many numbers are below the average.

Answers

import java.util.Scanner;

import java.util.Arrays;

public class JavaApplication47 {

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.print("Please enter 10 numbers: ");

       String [] nums = scan.nextLine().split(" ");

       int newNums[] = new int [nums.length];

       int w = 0, total = 0, above = 0, below = 0;

       for (int i=(nums.length-1); i>=0;i--){

           newNums[w] = Integer.parseInt(nums[i]);

           w++;

       }

       System.out.println("The old array is: "+Arrays.toString(nums));

       System.out.println("The new array is: "+Arrays.toString(newNums));

       Arrays.sort(newNums);

       System.out.println("The maximum is: "+newNums[9] + "\nThe minimum is: "+newNums[0]);

       for (int i : newNums ){

           total += i;

       }

       total = total / 10;

       for (int i : newNums){

           if (i >= total){

               above += 1;

           }

           else{

               below += 1;

           }

       }

       System.out.println("There are "+above+" numbers above or equal to the average.");

       System.out.println("There are "+below+" numbers below the average.");

   }

   

}

I hope this helps!

Write a program to output the following quote by Edsger W. Dijkstra:

"Computer Science is no more about computers
than astronomy is about telescopes"
- Edsger W. Dijkstra
Hint: Remember that the escape characters \n and \" can be used to create new lines and quotation marks in your code.

Answers

In python 3.8:

print("\"Computer Science is no more about \ncomputers\nthan astronomy is about telescopes\"\n-Edsger W. Dijkstra")

I hope this helps!

Categorize the options as belonging to the File menu or View menu,

File Menu

View Menu

Web Layout

Print

Zoom

Navigator

Page Preview

Print Layout

Full Screen

Where do I drag them too ? File menu and view menu

Answers

Answer:

The answer is below

Explanation:

In a Microsoft Office (Microsoft Word) on a Desktop or Laptop computer. The following functions or submenus are under the categorization of these main menus on the Microsoft Word window page:

For FILE MENU, We have the following:

1. Print Layout

2. Full Screen

3. Page Preview

For the VIEW MENU, we have the following:

1. Zoom

2. Print Layout

3. Web Layout

4. Navigator

Answer:

File Menu > Print, Page Preview

View Menu, Full Screen, Navigator, Print Layout, Zoom, Web Layout

Explanation:

Using a third-party package of your choice, write a program that reads the contents of a csv file and saves it to an Excel file. The program should take two arguments. The name of the input file and the name of the output file.

Answers

Answer:

import pandas as pd

df = pd.read_csv("file_csv")

df.to_excel("file.xlsx", sheet_name = "name_of_sheet")

# or use: with df.ExcelWriter("file.xlsx", mode='a') as file,

#df.to_excel(file, sheet_name= "sheet name")

Explanation:

This python source code uses the pandas package to read csv (comma separated values) file and converts it to an excel file (xlsx) using the read_csv and ExcelWriter methods respectively.

What is the name of the setting that creates a Green Dashed line and allows you to set angular locks when activation

Answers

Answer:

Polar Tracking

Explanation:

Polar Tracking a term or function in AUTOCAD that is used to identify a point closest to a predetermined angle and define a distance along that angle. This helps creates a line (which is a green dashed line). Thereby enabling a user to set angular locks when or during activation.

Hence, in this case, the correct answer to the question is POLAR TRACKING

Given two integer arrays, largerArray with 4 elements, and smallerArray with 3 elements. What is the result after this code executes?for = 0; i < 45 ++) { LargerArray) = smallerArray(); A. All of the elements of secondArray will get copied to firstArray. B. Error: The two arrays are not the same size. C. All the elements of firstArray will get copied to secondArray D. Some of the elements of firstArray will get copied to secondArray,

Answers

Answer:

A. All of the elements of secondArray will get copied to firstArray.

Explanation:

The correct iteration code is:

for(i =0; i<4;++i) {

largerArray[i] = smallerArray[i];

}

From the question, we understand that the largerArray has a size of 4 elements while the smallerArray has a size of 3 elements

Take for instance largerArray is {1,2,3,4} and smallerArray is {5,6,7}

Next, we analyze the loop

1. for(i =0; i<4;++i) {  --->This iterates from index 0 to index 3

2. largerArray[i] = smallerArray[i]; ---- > This assigns the elements of the smallerArray to largerArray.

However, it should be noted that the smallerArray has a maximum index of 2 while the largerArray has a maximum index of 3

The content of largerArray after the iteration will be:

largerArray = {5,6,7,5}

This is so because,

When i = 0

largerArray[0] = smallerArray[0] = 5

When i = 1

largerArray[1] = smallerArray[1] = 6

When i = 2

largerArray[2] = smallerArray[2] = 7

When i = 3

largerArray[3] = smallerArray[0] = 5

Notice that the last iteration refers to smallerArray[0]; this is so because index 3 do not exist in smallerArray. Hence, the index will be returned to the first index of the smallerArray

Taking largerArray as the firstArray and smallerArray as the secondArray.

We can conclude that option A answers the question because all elements in smallerArray is copied to firstArray

Write a for loop to print the numbers 88, 84, 80, ...44 on one line. Expected Output 88 84 80 76 72 68 64 60 56 52 48 44

Answers

The solution in python is:

for x in range(88, 43, -4):

   print(x, end=" ")

I hope this helps!

examples of operating system from different families​

Answers

Answer:

windows from Microsoft Mac OS from Apple Ubuntu from chronicle


A suggestion for improving the user
experience for the app navigation, has the
following severity:

Answers

Answer:

Following are the solution to the given question:

Explanation:

One of the most critical components found currently in IT existence is the user interface. Approximately 90 % of people are mobile and electronic equipment dependent.

Thus, software production was the idea that's happening. Thus, a better customer interface is required to boost output in application development. They have to think of it and create an app with consumers or the performance.

Start making better decisions with the world's leading survey platform. Already have an account? Log in for faster support.

Answers

Answer: ummmm is that a question?!?

Explanation:

Answer:

Mark brainliest please

what is the meaning of wonderful with affixes?​

Answers

An affix is a set of letters generally added to the beginning or end of a root word to modify its meaning.

Which tab should be selected to add a hyperlink within a cell? Home tab Review tab Insert tab Formula tab

Answers

Answer:

On the Insert tab

Explanation:

You would select the tab that you want the Hyperlink to be inselect the Insert tabThere you will see a panel that says link press the down arrow than you will see a section that says link again there again you will press the down arrow which will show a option of document you want to add if your looking to add a link form a web browser than at the bottom of the list you will see Insert LinkFrom there you will see a box pops up there you can upload a file from your computer or PCOnce the box pops up you will enter the web browser page address in the box that says addressFrom there press okay then your hyperlink will be in the cell you wantIf you don't know where or what a web browser address is than on the top of the web browser where you would insert what you are searching all you have to do is press it and it will automatically highlight the text than copy and paste the text by holding Ctrl + C to copy and holding Ctrl + V to paste

Answer:

insert tab

Explanation:

edge 2020

) Printers today have many features that include improved quality, photo printing capabilities, digital camera connectivity, built-in flash memory card readers, wireless connectivity, and faster speed. Suppose you are in the market for a new personal printer. Make a list of the most important features needed to meet your needs, and then research printers to identify the best printer for your needs. Be sure to consider both the price of the printer and the price of consumables (such as paper and ink/toner) in your evaluation process. (3 marks)

Answers

Explanation:

Some of the most important features needed in a printer are:

fast printing speedsupport wireless connectivitysupport colored/uncolored printinginclude improved text quality,improved photo printing capabilities

Based on market prices available on the Amazon website, a printer with the above capabilities start at a price range of at least $80.

Given a type Money that is a structured type with two int fields, dollars and cents. Assume that an array named monthlySales with 12 elements, each of type Money has been declared and initialized. Assume that a Money variable yearlySales has also been declared. Write the necessary code that traverses the monthlySales array and adds it all up and stores the resulting total in yearlySales. Be sure make sure that yearlySales ends up with a valid value, i.e. a value of cents that is less than 100.

Answers

Answer:

Attached below is the code

Explanation:

using namespace std;

struct Money

{

int dollars;

int cents;

};

int main()

{

struct Money monthlySales[12];

struct Money yearlySales = { 0,0};

for(inti=0; i<12; i++)

{

monthlySales[i].dollars = 0.0;

monthlySales[i].cents = 0.0;

}

for(int i=0; i<12; i++)

{

yearlySales.dollars = yearlySales.dollars + monthlySales[i].dollars;

yearlySales.cents = yearlySales.cents +monthlySales[i].cents;

}

return 0;

}

What property must be set on a menu item to have the user activate that option by pressing Ctrl C on the keyboard

Answers

Answer:

ShortcutKeys

Explanation:

ShortcutKeys is a term used in computing to describe a combination of two or more keys to perform specific actions in a faster way.

Some shortcut keys have been programmed on the operating system of the computer, while a user can also create some through scripting coding.

For example, Ctrl + B is for Bold, while Ctrl + A is for select all.

Hence, to have the user activate the SHORTCUT option by pressing Ctrl C on the keyboard, a SHORTCUTKEYS property must be set on a menu item

Suppose that you have been asked to create an information system for a manufacturing plant that produces nuts and bolts of many shapes, sizes, and functions. What questions would you ask, and how would the answers affect the database design

Answers

Answer:

Following are the solution to this question:

Explanation:

In essence, both issues (relevant) were addressed, that form the design of the system, and all of the information collected and during initial analysis along with all subsequent stages will, in turn, affect the design of the system. Being aware, that perhaps the data is obtained to establish the entities, attributes, or relations. In particular, partnerships, clearly outline, or cardinal-ties are shaped by company policies derived from the creator's information. Example problems and the probable effects on the layout may be:

It will create the file concurrently for all depts, or would like to build and execute the database simultaneously with one dept?  

How would the work be to design affect the development process? In other terms, determine the range of the system as well  

as its limits about the bottom-up, centralized, or decentralized.

Do you want, and would you like an integrated framework to develop a single module? (Inventory, production, shipping, billing, etc.)  

Would you like a product code, output change, and form of controlling the bolts and bolts and dept? Impact: design of the logical and physical server.  

Perhaps you'd like to monitor the sources of every lot a raw resources for the nuts and bolts manufacturing? Impact: design of the logical and physical server. Model E-R.  

Perhaps you'd like to monitor consumers receiving shipments of bolts and nuts? Impact: design of the logical and physical database. ER model.  

Its documents will you demand, or to whom can these documents be transmitted? What specific reporting requirements?  

Reactions to such concerns relate to the design, execution, testing, or subsequent functioning of the logical and physical system.

The sensitivity range for an objective function coefficient is the range of values over which the current __________________ remains the same.

Answers

Answer:

Optimal solution point

Explanation:

The sensitivity range for an objective function coefficient is the range of values over which the current optimal solution point remains the same.

Additionally, the range of optimality can be defined as the optimality range with respect to an objective coefficient that comprises of the range of values over which a current optimal solution point will always remain optimal.

Hence, the managers supervising various production lines are saddled with the responsibility of focusing on the objective function coefficient for optimal level of output or productivity.

Need help with 4.7 lesson practice

Answers

Answer:

1.a

2.sorry cant read it that wekk

3.c

Explanation:

Display all the lines in unixPasswd that contain at least 10 consecutive lowercase letters. How many names are there in total that meets this criteria?

Answers

Answer and Explanation:

To display 10 consecutive lower case letters in Unix, we make use of the commands below. The first command finds the letters in the file and the second command counts them line by line.

$ grep '[a-z]\{10,\}' /unixPasswd/passwd

# this command displays lines with at least 10 consecutive lowercase letters or more than 10 consecutive lowercase letters

$ grep '[a-z]\{10,\}' /unixPasswd/passwd | wc -l

# this command counts the number of lines that has at least 10 consecutive lower case letters or more than 10 consecutive lowercase letters

Note: the unixPasswd is a file in passwd file. The # is used when we want to add comments, is optional here. The $ is a prompt on the terminal that begins a new command.

A user invokes an app that writes a file. The app displays a progress bar that shows how much of the file has been written. Just as the progress bar reaches 50%, the battery fails and the device crashes. When the user reboots the device, he or she discovers that less than 20% of the file has actually been written. Explain why the app reported writing 50%. Frame your answer in terms of the design of I/O device drivers.

Answers

Answer:

The app reported writing 50% before the battery fails is because while writing, the data is been saved in the secondary memory via a buffer and not directly to the primary memory ( RAM ) and its returned from the secondary memory via the buffer to the primary memory

Explanation:

The app reported writing 50% before the battery fails is because while writing, the data is been saved in the secondary memory via a buffer and not directly to the primary memory ( RAM ) and its returned from the secondary memory via the buffer to the primary memory

What the app displays as a progress bar is from the Buffer, this is because as the developer was designing the app he wanted the data entry to be very fast  hence he had to send the file through a buffer with the aid of a workstation he designed. so if the secondary storage is slow in returning the data  back to the primary memory as fast as it entered the secondary memory via the Buffer, Then the percentage of the file that would be displayed as written when the system reboots will be less than what the app displayed before the reboot i.e. 20% < 50%

plsss help me
give two examples of problems that can occur when sytems do not work properly​

Answers

Answer:

Explanation:

1. There can be a run out of something ex. The water cycle we could run out of water if evaporation stops happening

2. Something wont happen ex. In a shoe factory if no one is boxing the shoes the shoes don’t get boxed.

Hope this helps

Other Questions
BIG POINTS this is a kinda givaway lols whats 1+1+2-3+10-21 divided by 3 times 2 +69 -420 +0 + my iqMy iq is 21 The work done by effort is called Work out the length x.7.5 cm16 cm Question 3 of 20Debbie is a pathologist. Which of the following specialized measurements isshe likely to use in her everyday tasks?A. MolesB. MicromortsC. GrainsD. Bits Plz can someone help me show work for these two problems!! 3x + y = 13 2x - y = -1 6/5 divded by (-3/2) Love gives naught but itself and takes naught but from itself. Love possesses not nor would it be possessed; For love is sufficient unto love. In this first sentence from the passage, what does naught mean?A) nicely B) never C) naughty D) nothing In what ways did the philosophies of Confucianism and Buddhism shape the government, society and culture of China, Korea and Japan? Which of the following must be included when citing a Web site?the publisherthe date you accessed the sitethe authors namethe entire URL placed inside Pls answer 4 and 5 for brainly A complex sentence- *contains two dependent clausescontains two simple sentences joined togethercontains two independent clausescontains one independent clause and one dependent clause A scientist hypothesizes the the temperature at which an alligator's egg is incubated will determine whether the alligator will be male or female. The dependent variable is What did the Supreme Court decide in the Terry vs. Ohio case?A. The police officers acted illegally when they frisked the men.B. The police officers are allowed to frisk people if they suspect that person to be dangerous or acriminal.. The police officers are only allowed to frisk someone if they can prove that person is a threat.D. The police officers are not allowed to frisk anyone without a search warrant. 2. Convert 25.2625 from decimal degrees to degrees-minutes-seconds. 3. What is a negative consequence forless prosperous countries whenmanufacturing is outsourced to them?OImproved infrastructureO Increased pollutionO Increased national incom a person with cystic fibrosis should avoid.. On the map above, which city is labeled number 7? A. Delhi B. Mumbai C. Dhaka D. Kabul A company making backpacks charges $39.99 for each backpack. It costs $12.55 to make each backpack. The company can make backpacks in multiples of 10 and there is $900 dollars in fixed costs. The company wants to make at least $3000 profit each week. according to the article what are two benefits of helathy soil Select the correct answer.Which characteristic is true of all negative business messages?O A. They should be written as business letters.B. They should offer reasons or explanations.OC. They should be directed at a large audience.D. They should be informal in tone.