subject

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;}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 00:40
If you arrive at the same time as another user straight across from you yield if a. they flash your headlights at you b. you can’t see their turn signals c. you’re going street and they’re running d. you’re turning they’re going straight plz
Answers: 1
question
Computers and Technology, 22.06.2019 20:40
Write a program that begins by reading in a series of positive integers on a single line of input and then computes and prints the product of those integers. integers are accepted and multiplied until the user enters an integer less than 1. this final number is not part of the product. then, the program prints the product. if the first entered number is negative or 0, the program must print “bad input.” and terminate immediately. next, the program determines and prints the prime factorization of the product, listing the factors in increasing order. if a prime number is not a factor of the product, then it
Answers: 2
question
Computers and Technology, 23.06.2019 07:30
What key should you press and hold to select and open multiple files at one time? enter alt control esc
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
Facial expressions and gestures are examples of messages.
Answers: 3
You know the right answer?
Write a loop that sets each vector element to the sum of itself and the next element, except for the...
Questions
question
Mathematics, 18.12.2019 18:31
Questions on the website: 13722361